About context variables

Related topics

The purpose of the context variables is to have variables which are transferred between tasks within the same task hierarchy. A context variable will always belong to one context (audit ID). When the execution thread terminates, the context variables are automatically deleted.

This means that one task can add a context variable, and another task (within the same context) can read and/or modify the context variable.

u-functions

The following functions are available in the runtime engine for handling the context variables:

Pre-defined context variables

A context variable starting with "#Mx" is reserved, and cannot be modified.

By setting the option "Use context variables" on a task, a set of pre-defined context variables will be added.

Context variable

Value

#MxEventType

The type of event which started this task. This can be one of the following:

1: EntryAdd

2: EntryModify

3: EntryDelete

4: AttributeAdd

5: AttributeModify

6: AttributeDelete

7: OnOK

8: OnError

9: Provision task

10: Deprovision task

11: Modify privilege task

12: InitTask

13: OnChainOK

14: OnChainError

#MXEventAttrCount

Number indicating how many attributes where changed.

This is used in the naming of the following attributes. If for example 3 attributes are modified, there will be #MxEventAttrName_1, #MxEventAttrName_2 and #MxEventAttrName_3, with the corresponding values.

Multi-value attributes will be added as multiple variables in the same way.

Note that this information is only added if the corresponding event task property is enabled.

#MxEventAttrName_n

Attribute name which started the task.

Important: This must be the name and not the ID of the attribute, to be able to handle configuration staging.

#MxEventAttrValue_n

The new value of the attribute. Empty if operation was delete.

#MxEventAttrOldValue_n

The previous value of the attribute. Empty if operation was add.

#MxEventAttrtype_n

Used for modify entry task, indicating if the attribute was added, modified or deleted.

#MxParentAuditId

Audit ID of parent.

#MxRepositoryId

Repository identifier.

#MxParentTaskId

ID of task which started this task.

 

Note: Tasks started from the User Interface will not have any of these context variables set.

Note: Any attributes which are larger than around 2K will not be copied to the context variables.

Note: If the "Use context variables" option is not set, no context variables will be created.

Examples

The workflow task “Edit user” is started, to modify the first and last names as follows. When pressing submit on this task, two tasks will be started in parallel: the “edit user” task and the event task on the attributes. These will have the following context variables.