ftos.context
JSON object that stores information about the workflow context of the client-side process that called the script.
The context object is useful when a client process triggers a server automation script via a function such as ebs.callAction or ebs.callActionByNameAsync and you need to process on the server-side information such as the current entity name, business status, or the user running the digital journey.
It is also useful in event-triggered scripts to track the exact changes that occur in the database during record inserts, updates, and deletions.
Syntax
{
additionalValues : WorkflowContextAdditionalValues;
beforeValues : any;
businessStatus : string;
currentBWS : string;
data : any;
entityName : string;
executionDepth : number;
fetch : any;
id : string;
mergedValues : any;
parentContext : EbsWorkflowContext;
previousBusinessStatus : string;
previousBWS : string;
propertyBag : any;
userId : string;
values: any;
hasChanged(attributeName : string): boolean;
}
Properties
| Property | Type | Description |
|---|---|---|
| ftos.context.additionalValues | WorkflowContextAdditionalValues | Updated values of a record that is subjected to a CRUD operation for all the items that are not entity attributes (additional values and entity extensions). Also see the beforeValues, mergedValues, and values attributes. |
| ftos.context.beforeValues | any | All attribute values of a record before it is subjected to a CRUD operation. Also see the additionalValues, mergedValues, and values parameters. |
| ftos.context.businessStatus | string | Current entity BusinessStatus primary key value (Guid). |
| ftos.context.currentBWS | string | Current entity Business Status name. |
| ftos.context.data | any | Stores input parameters passed by the client process, for instance via an ebs.callActionByNameAsync function. |
| ftos.context.entityName | string | Current entity name (populated inside Data Events). |
| ftos.context.executionDepth | number | Nested execution depth. Each time a script calls an API that triggers another script execution, the execution depth is incremented. When the execution returns to the caller the execution depth is decremented. |
| ftos.context.fetch | any | Contains the fetch object when the data event type is 'read'. In this case, you can instrument the fetch before it is sent to the data service. |
| ftos.context.id | string | Current entity primary key value (Guid). |
| ftos.context.mergedValues (readonly) | any | Updated values of all the attributes of a record that is subjected to a CRUD operation. This is obtained by overwriting the entries in the beforeValues parameter with the entries in the values parameter. Also see the additionalValues, beforeValues, and values parameters. |
| ftos.context.parentContext (readonly) | context | Returns the parent context. |
| ftos.context.previousBusinessStatus | string | Current entity PreviousBusinessStatus primary key value (Guid). |
| ftos.context.previousBWS | string | Current entity previous Business Status name. |
| ftos.context.propertyBag | any | Allows to dynamically share values in multiple scripts during the lifetime of a request. |
| ftos.context.userId | string | Authenticated user running the workflow (Guid). |
| ftos.context.values | any | Updated values of the attributes that are changed in a CRUD operation. Also see the additionalValues, beforeValues, and mergedValues parameters. |
Methods
Checks if the attribute value has changed.
Syntax
hasChanged(attributeName : string): boolean;
| Parameter | Type | Description |
|---|---|---|
attributeName
|
string | Returns True if the attribute value has changed, False otherwise. |
Return Value
Returns True if the attribute value has changed, False otherwise.
Type Aliases
WorkflowContextAdditionalValues = WorkflowContextAdditionalValuesIndexers & WorkflowContextAdditionalValuesNoIndexers;
{
[key : string] : any;
}
{
VirtualAttributes: WorkflowAttributeValue[];
}
{
attribute : string;
value : any;
}
| Property | Type | Description |
|---|---|---|
attribute
|
string | Attribute name. |
value
|
any | Attribute value. |
Examples
In this example, we set up the following code in the Before stage of the Update event on an event triggered script in order to log the record updates on a given entity:
log('Record ' + context.id + ' in entity ' + context.entityName + ' was updated.');
log('--- Attribute Values Before the Update ---');
log(context.beforeValues);
log('--- Attributes That Were Modified ---');
log(context.values);
log('--- Attribute Values After the Update ---');
log(context.mergedValues);
log('--- Additional Values After the Update ---');
log(context.additionalValues)