Skip to main content

Standard variables

Every package execution is given a set of standard variables describing the event that triggered it. Some are always present; others depend on the kind of event.

  • source — data about the trigger. For webhooks it contains:
    • source.body — the request body
    • source.headers — the request headers
  • event (also available as source.event) — the event name. For example:
    • webhooks: request.update, …
    • scheduled events: scheduler.trigger_name
    • inbound email: email-in.trigger_name
  • mail — the mail data; only present for inbound email events.
  • apiUserId — depends on the configured account.

The request body

For webhook events, source.body is usually the most important value: it is the body of the inbound HTTP request, so its contents depend on the type of webhook.

For Xurrent webhooks, the contents are defined in the Xurrent webhooks documentation. For example, source.body.person_id contains the id of the person that triggered the webhook, and source.body.payload.sourceID contains the source id of the Xurrent record that triggered it.

Xurrent trigger objects

When a package is triggered by a Xurrent webhook, a convenience object for the triggering record is made available:

  • an incoming request webhook provides a request object,
  • an incoming task webhook provides a task object,
  • an incoming workflow webhook provides a workflow object,

and so on for other Xurrent webhooks. The object holds the data of the Xurrent record that triggered the webhook, and can be used directly in any language construct:

log('Id', request.id);
log('Impact', request.impact);
log('Requester', request.requested_by);

Thanks to auto-fetch, you can navigate from these objects into related records with dot notation, no matter how deeply nested, and each record is fetched from Xurrent on access:

request.workflow.service.service_owner.manager.primary_email;

The full set of available fields is listed in the Xurrent field reference.

Overriding standard variables

When a package is run from another package with execute_package, the caller can supply a data object that overrides the standard variables injected into the called package. See Orchestration.