Workflow Best Practices

Accessing an element in an array via index

Use the following sample expression to access an element in an array via index in FABRIC_WORKFLOW_CONTEXT namespace.

FABRIC_WORKFLOW_CONTEXT.resp.Employee.get(2).name

This means, if a response has an array of Employee in FABRIC_WORKFLOW_CONTEXT.resp.Employee, then you can get the name of the third employee by this expression.

Accessing scope attributes via FABRIC_WORKFLOW_CONTEXT namespace

Use Case: Workflows are executed in the background. In case of long-running workflows, if you are using attributes from an identity scope or session scope, there is no guarantee that those attributes are available throughout the workflow execution.

Recommended best practices: When a workflow needs any kind of attributes from an IDENTITY or SESSION scope, always try to populate the necessary data from all other scopes to FABRIC_WORKFLOW_CONTEXT, and use these values from FABRIC_WORKFLOW_CONTEXT.

You can configure the attributes from an IDENTITY or SESSION scope by using Process Incoming Payload mapping editor or a service task.