callProcedure Method

The callProcedure method lets the plug-in interact with Oracle Field Service Core Application without leaving the plug-in's page. This method is implemented using the remote procedure call (RPC) approach.

The callProcedureResult method returns the result of running the callProcedure. As you can run multiple procedures simultaneously, it is possible that the plug-in sends the next callProcedure messages to Oracle Field Service before it sends the callProcedureResult message back. These results can be associated with the procedure calls using the callId parameter. For backward compatibility, simultaneous calls of multiple openLink procedures or multiple scanBarcode procedures cause an error with the error code CODE_METHOD_UNEXPECTED.

You can perform these actions on a plug-in through the callProcedure method:
  • Open a plugin in the background (wake up) even when the device is offline.
  • Define a delay for opening a plug-in in the background after closing its window. You can set it as short as 10 seconds.
  • Extend the period of background operation for a plug-in before being required to close (sleep). You can set it between 10 seconds and 1 hour.
  • Update the appearance (icon, color, text) of a plug-in's button (or multiple buttons) on My Route without closing a plug-in that is working in the background.
  • Navigate to En route and Stop travel pages when the plug-in is closed.
  • Call some procedures through the Plugin API without actually calling them.

callProcedure Sequence

This diagram shows the sequence in which callProcedure is run:
This flowchart shows how the callProcedure method is run.
callProcedure method parameters
This table lists the parameters of the callProcedure method:
Parameter Name Mandatory Type Description
apiVersion Yes Integer Plugin API version.
method Yes String Must equal callProcedure.
procedure Yes String Procedure name.
callId Yes String Unique string identifier, which is used to apply the procedure response within the plug-in.
Example of callId Generation
function generateCallId() {
    return btoa(String.fromCharCode.apply(null, window.crypto.getRandomValues(new Uint8Array(16))));
}

Calling of Procedures

You can send the callProcedure messages for plug-ins that are opened in background after they receive a wakeup message. You can use only the updateIconData and updateButtonsIconData procedures with the plug-ins that are opened in background. These procedures help the plug-in update the appearance of its buttons in real-time to notify the user about the updates it has received.