Script Triggers Defined in the managed object configuration

For information about how managed objects are handled, and the available script triggers, see Managed Objects.

Managed Object Configuration Object

Trigger Variable

onCreate, postCreate

  • object: The content of the object being created.

  • newObject: The object after the create operation is complete.

  • context: Information related to the current request, such as client, end user, and routing.

  • resourceName: The resource path of the object of the query. For example, if you create a managed user with ID 42f8a60e-2019-4110-a10d-7231c3578e2b, resourceName returns managed/realm-name_user/42f8a60e-2019-4110-a10d-7231c3578e2b.

  • request: Information related to the request, such as headers, credentials, and the desired action. Also includes the endpoint, and payload to be processed.

onUpdate, postUpdate

Returns JSON object

  • object: The content of the object being updated.

  • oldObject: The state of the object, before the update.

  • newObject: Changes to be applied to the object. May continue with the onUpdate trigger.

  • context: Information related to the current request, such as client, end user, and routing.

  • resourceName: The resource path of the object the query.

  • request: Information related to the request, such as headers, credentials, and the desired action. Also includes the endpoint, and payload to be processed.

onDelete, onRetrieve, onRead

Returns JSON object.

  • object: The content of the object.

  • context: Information related to the current request, such as client, end user, and routing.

  • resourceName: The resource path of the object the query.

  • request: Information related to the request, such as headers, credentials, and the desired action. Also includes the endpoint, and payload to be processed.

postDelete

Returns JSON object.

  • oldObject: Represents the deleted object.

  • context: Information related to the current request, such as client, end user, and routing.

  • resourceName: The resource path of the object the query is performed upon.

  • request: Information related to the request, such as headers, credentials, and the desired action. Also includes the endpoint, and payload to be processed.

onSync

Returns JSON object

  • oldObject: Represents the object prior to sync. If sync has not been run before, the value will be null.

  • newObject: Represents the object after sync is completed.

  • context: Information related to the current request, such as client, end user, and routing.

  • request: Information related to the request, such as headers, credentials, and the desired action. Also includes the endpoint, and payload to be processed.

  • resourceName: An object representing the resource path the query is performed upon.

  • syncResults: A map containing the results and details of the sync, including:

    • success (boolean): Success or failure of the sync operation.

    • action: Returns the name of the action performed as a string.

    • syncDetails: The mappings attempted during synchronization.

onStore, onValidate

Returns JSON object

  • object: Represents the object being stored or validated.

  • value: The content to be stored or validated for the object.

  • context: Information related to the current request, such as client, end user, and routing.

  • resourceName: The resource path of the object the query is performed upon.

  • request: Information related to the request, such as headers, credentials, and the desired action. Also includes the endpoint, and payload to be processed.

Property Object

Trigger Variable

onRetrieve, onStore

Returns JSON object

  • object: Represents the object being operated upon.

  • property: The value of the property being retrieved or stored.

  • propertyName: The name of the property being retrieved or stored.

  • context: Information related to the current request, such as client, end user, and routing.

  • resourceName: The resource path of the object the query is performed upon.

  • request: Information related to the request, such as headers, credentials, and the desired action. Also includes the endpoint, and payload to be processed.

onValidate

Returns JSON object

  • property: The value of the property being validated.

  • context: Information related to the current request, such as client, end user, and routing.

  • resourceName: The resource path of the object the query is performed upon.

  • request: Information related to the request, such as headers, credentials, and the desired action. Also includes the endpoint, and payload to be processed.