Declaring variables for client-side human services
For each client-side human service that you create, declare
variables to capture the data that steps or activities in that human
service use.
About this task
You can add the following variables to your client-side human service.
Variable | Description |
---|---|
Input | Variables that represent input data passed to the current client-side human service |
Output | Variables that represent output data that the current client-side human service returns to its caller |
Private | Local variables that are used only within the client-side human service |
Exposed Process Values | Exposed process values (EPVs) can be linked to and used from a client-side human service |
Environment Variables | Environment variables can be linked to and used from a client-side human service |
- Default variable values
- For input and private variables that you define for
either root or nested client-side human services, you can specify default values that take effect at
run time. For the default values, you can specify both simple and complex values, as well as arrays
for lists. Depending on how the client-side human service is used, the default values take effect as follows:
- When the client-side human service is implemented as a task, and the process instance specifies
variable values for the task through input mapping, the specified values take effect at run time. If
a mapped variable from the process is not initialized, its mapped
null
value is used. If no variable values are specified (no mapping), the default values take effect at run time. See also Creating versus starting a client-side human service task in a process. - When a client-side human service is implemented as a startable service or a URL, for example, if there are input variable values that are specified as URL parameters, the specified values take effect at run time. Otherwise, the default values take effect.
- When a nested client-side human service is called from a parent client-side human service and the parent specifies variable values through input mapping, the specified values take effect at run time. If there is no mapping, the nested service uses the default values. If there is a mapping, the nested input uses the parent variable value, even if it is uninitialized.
- When variables are declared inside an event handler of either error or data change type, the default values take effect the first time the event handler runs in the current instance of the nested service that contains the event handler. If you exit the client-side human service that contains the event handler and enter it again, all the variables, including the event handler variables, are reset.
Tip: In client-side human services that are implemented as instance details user interfaces, only private variables can have default values. - When the client-side human service is implemented as a task, and the process instance specifies
variable values for the task through input mapping, the specified values take effect at run time. If
a mapped variable from the process is not initialized, its mapped
- Exposed process variables (EPVs) and environment variables
- You can link to existing exposed process values (EPVs) and environment variables in the
Variables view of a client-side human service, so that you can access the
variables through scripts that you defined for your client-side human service. You can reference the
name of the variables as follows:
- tw.epv.[epv_name].[epv_variable_name]
- tw.env.[env_variable_name]
- Creating versus starting a client-side human service task in a process
- The following expected behavior occurs when you use a client-side human service task in a
process or call a Business Automation Workflow REST process or task
API. Depending on which task instance is used for the data retrieval, Process Inspector might show
out of sync data for the task, as follows:
- When the task is created, data is retrieved from the process instance at creation time.
- At a later time, when a user starts the task, data is retrieved from the runtime process instance, which might be different from the data when the task was created.
Procedure
To add an input, output, private, or EPV variable to the client-side human service: