The offline function rule API consists of a JavaScript method that allows you to run a function rule in offline-enabled applications by using a Run script action or a custom JavaScript function.
The following JavaScript method is available for the pega.offline
object:
Method |
Description |
||||||
runFunction( functionName, functionLibrary, parameters )
|
A synchronous method that runs a function rule in offline mode with the specified name. It returns the return value that is specified for the function. The method has the following parameters:
|
The following sample JavaScript code allows you to run a function rule called isInThePast
, which belongs to the Default
class, passing as a single parameter a Pega PlatformDateTime String type. The purpose of this function is to check whether the specified date is in the past.
if ( pega.offline.runFunction("isInThePast", "Default", {dateAndTime : "20151027T162300.000 GMT" }) ) { console.log("Date " + dateAndTime + " is in the past!"); }
The following sample JavaScript code allows you to run the same function rule as above, passing as a single parameter a Date JavaScript object instead.
if ( pega.offline.runFunction("isInThePast", "Default", {dateAndTime : new Date(2015, 10, 27, 16, 23, 00)}) ) { console.log("Date " + dateAndTime + " is in the past!"); }