Platform Functions

FireEvent(name, target?, params?) : Boolean

Executes all handlers of the specified event (event handler views and workflows).
Returns true if at least one event handler was found and executed.

FireEvent Parameters

name : String
Event name.

target? : String?
Event target.

params? : Dict?
Additional event parameters.

FireEvent Examples

// Search for all views of type EventHandler with name 'CustomEvent' and execute them with provided parameters.
// Then search for all public workflows with name 'CustomEvent' and execute them with specified parameters.
var handled = FireEvent('CustomEvent', 'SomeTarget', { Param = true });

RemoteEvent(name, target?, params?, force = false) : Boolean

Sends remote event to subscribed clients.
Returns false if runtime events are disabled (e.g. in service mode).

RemoteEvent Parameters

name : String
Event name.

target? : String?
Event target.

params? : Dict?
Additional event parameters.

force : Boolean = false
True to force sending in simulation mode.

RemoteEvent Examples

var sent = RemoteEvent('CustomEvent', 'SomeTarget', { Param = true });

ServiceMode(operation, disableEvents = false)

Performs operation in service mode (with less restrictions and ignoring permissions).

ServiceMode Parameters

operation : Function
Operation to perform in service mode.

disableEvents : Boolean = false
True to disable runtime events (affects FireEvent, RemoteEvent functions and items events like OnChange).

ServiceMode Examples

ServiceMode(() => DeleteItem(item)); // ignore permissions

Transaction(operation, commitMessage?)

Alias: Simulate

Performs operation in simulation/write mode.

Transaction Parameters

operation : Function
Operation to perform in simulation or write mode.

commitMessage? : String
Provide commit message to perform real transaction – if you omit the message it will be simulated only

Transaction Examples

Transaction(() => $.SomeSolution.SomeType.CreateItem({ Name = 'Test' })); // simulate item creation

Translate(key) : String?

Returns translation for the key using current user’s locale.

Translate Parameters

key : String?

Translate Examples

var translated = Translate('SomeKey');

Leave a Comment

Your email address will not be published. Required fields are marked *