Auto-fetch for Xurrent
AutomatorScript has an auto-fetch feature for records obtained from the Xurrent REST API via fetch, fetchAll or fetchFilter.
This means that when navigating through the data model, data is automatically fetched as needed,
and there is no need to write explicit code to fetch data.
The resulting code is much more readable, maintainable and easier to develop.
The auto-fetch feature also works for the Xurrent trigger object that is available when a package is triggered by a webhook.
Example
Suppose a package is triggered by a request.created webhook. The request variable is then automatically available in
the package, and it can be navigated via auto-fetch.
let workflow = request.workflow; // workflow is auto-fetched
if (!workflow) {
log('Request has no workflow', request);
return;
}
for (let task of workflow.tasks) { // tasks are fetched
// team is auto-fetched, then coordinator person, then organization.
let team_coordinator_organization = task.team.coordinator.organization;
log(`The coordinator of task ${task.id} belongs to organization ${team_coordinator_organization}`);
}