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 that is 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
nullvalue 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.
- Later, 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.
- Exposing business data at user task level for use in search APIs
- You can now expose business data at task activity level in addition to simple-type and nonlist
variables at process level. It means that the data is available for searching when user task
instances are running or have completed, allowing for effective retrieval of relevant information.
Also, you can define aliases for the exposed variables and use them along with task and process
metadata in task search APIs.
For UI developers, business data searches provide control over searchable task data, exposing only relevant information. For business users, it helps in building and refining task searches in Workplace by using specific data values during and after task completion.
Tip: Business data searches work for both advanced and basic searches. However, for the basic searches you need to have the federated data repository indexing configured. For more information, see Enabling the Federated Data Repository process indexing. For more information on how to use the exposed business data in your searches, see Searches in Workplace.You can expose the following variable types:
Table 2. Variable types that can be exposed Variable type Available in task search Simple-type (for example, Boolean, string, integer) Yes Nonlist (single-value) Yes List (multi-value) No Composite-type No Simple-type properties of business objects Yes
To expose business data and define an alias for it:
- In your client-side human service, go to the Variables tab and select the variable that you want to expose.
- Select Expose in work environments to make the business data available in the user task activity.
- In the Alias field, type a unique name that you want to assign to the exposed variable.
Note: The name needs to be unique within the client-side human service, unless it is shared with an
input or output variable with the same name, type, and cardinality.
Procedure
To add an input, output, private, or EPV variable to the client-side human service:
This topic is shared by BAW, CP4BA, CP4BASaaS. Last updated on 2025-03-13 12:15