Plugin Rules and Guidelines
You create a plugin on the Forms & Plugins page and add it as a button on the required page. You can also add buttons on the activity hint. You can configure the plugin during creation or editing of an Action link.
Plugin URL must point to the main page of the plugin's source files. The plugin needs the HTTPS protocol. Main page of the plugin must be accessible via configured Plugin URL. Its content is a valid HTML/XHTML page, that should load JavaScript code sources, static resources (images, .css stylesheets) or contain them itself.
For a plugin to be treated as a valid plugin, the main page must run the JavaScript code that interacts with Oracle Fusion Field Service through the Plugin API.
- To make a plugin accessible offline, it must use a Service Worker that loads its resources for offline use. However, you must be aware of their availability in different versions of browsers and operating systems.
A plugin can save data for offline locally on the user's device using cookies, the localStorage property, or the IndexedDB object.
The plugin’s URL is loaded into iframe, and the URL points outside the Oracle Fusion Field Service domain. Therefore the plugin’s application cache, cookies, the localStorage property, and the IndexedDB object are separated from that of Oracle Fusion Field Service. These elements can't interfere with one another, according to the Same origin policy, described on the https://www.w3.org website. Most properties of the parent window (window.parent property) are also unavailable for the plugin's JavaScript. So, the only way to interact with Oracle Fusion Field Service is through the Plugin API
The plugin API is based on messages. Oracle Fusion Field Service sends the messages and the plugin receives them. Similarly, the plugin sends the messages and Oracle Fusion Field Service receives them. JavaScript code uses the window.postMessage() method to send the messages, and the receiver receives by subscribing to the window.addEventListener() method.
Transport
Plugin API is based on postMessages - https://developer.mozilla.org/ru/docs/Web/API/Window/postMessage, that can be sent by OFS and received by Plugin and vice versa.
postMessages are sent by JavaScript code using window.postMessage() method, and received by subscribing to messages using window.addEventListener().
Debugging
Use:
setOfscDebugModes(true, 'pluginApi');
in Browser Console to enable debugging mode. It will show information about stages of initialization and all post messages between platform and plugin. To disable the debugging mode use:
setOfscDebugModes(false, 'pluginApi');