Message Formats
You can send a message to a plugin as a string, containing serialized JSON data, or as a raw JavaScript object.
window.parent.postMessage('{"apiVersion":1,"method":"close","activity":{"cname":"John"}}', targetOrigin);
window.parent.postMessage({
apiVersion: 1,
method: 'close',
activity: {
cname: 'John'
}
}, targetOrigin);
function getPostMessageData(event)
{
var data = JSON.parse(event.data);
switch (data.method)
{
case 'open':
pluginOpen(data);
break;
default:
showError();
}
};
window.addEventListener("message", _getPostMessageData, false);
{
"apiVersion": 1,
"method": "open",
"entity": "activity",
"resource": {
"pid": 5000038
},
"inventoryList": {
"20997919": {
"invid": 20997919,
"inv_pid": 5000038,
}
}
}
Where:apiVersion, method: Common fields.
entity: Name of the Oracle Fusion Field Service entity that's to be processed by the plugin. Available only for the 'open' method.
resource, inventoryList: Entity data collections. Available only for 'open' and 'close' methods.
apiVersion: Version of the plugin API that's used for interaction between and Oracle Fusion Field Service and the plugin. Available methods and data depend on it. This is a required parameter. You must include this parameter in the message for the plugin to be processed without any errors.
method: Describes the action initiated by Oracle Fusion Field Service or the plugin, and the actions that should be performed by other side.