JavaScript API for client-side human service development
Use the following reference information to learn more about the client-side JavaScript system variables that are available in designer for client-side human service development.
These variables are populated when the client-side human service is run and reflect the state of the system at that point in time. These variables are not meant to be updated within the client-side human service.
Additional system data is available by calling a service that retrieves the system variables that you are interested in, and returning them back to the client-side human service.
Restriction: Note that all
tw.* variables listed in the following table are applicable to client-side human service JavaScript scripts only, and cannot be used in coach and view scripts, including view inline JavaScript, view included scripts, user-defined view event scripts, visibility by script, view instance events, and so on. The coach-related JavaScript code runs in the coach runtime context, which is different from the client-side human service context, and therefore cannot access the tw object that is available only in the client-side human service context.
| Variable | Description |
|---|---|
| tw.constants.ECMServerNames | Server names that can be used in Content Integration steps. |
| tw.constants.ECMServerNames.IBM_BPM_CONTENT_STORE | The server name for the content store. |
| tw.constants.ECMServerNames.IBM_BPM_DOCUMENT_STORE | The server name for the document store. |
| tw.env | The namespace for accessing environment variable values from the context under which the client-side human service was called. The variable must be linked to the client-side human service. |
| tw.env.toolkit | The namespace for accessing environment variable values from the context of the specified toolkit. The environment variable that is defined in the toolkit must be linked to the client-side human service. |
| tw.epv | The namespace for accessing EPV variable values from the context under which the client-side human service was called. The EPV must be linked to the client-side human service. |
| tw.epv.toolkit | The namespace for accessing EPV variable values from the context of the specified toolkit. The EPV that is defined in the toolkit must be linked to the client-side human service. |
| tw.error | The namespace that provides information about the last caught error. |
| tw.error.code | The code of the last caught error. |
| tw.error.data | Data about the last caught error that can be mapped to a local variable. |
| tw.error.message | A message about the error that occurred, which the app or client-side human service author might want to display from a coach to the end user. |
| tw.resource.lrname.property | The namespace for accessing localization resources in client-side human service JavaScript scripts. In the syntax, lrname is the name of a localization resource, and
property is a property name. For example, tw.resource.LR1.ant
produces the translation of property ant in the localization resource
LR1. |
| tw.system.coachUtils.getLocallyChangedVars() | Returns an array of variable names which have changed in the coach since it started running. This method applies only when used in a data change event handler. |
| tw.system.coachUtils.hasLocallyChangedInputVars() | Returns true if the input variable values have changed in
the coach since it started running. This method applies only when used in a data change event
handler. |
| tw.system.coachUtils.hasLocallyChangedOutputVars() | Returns true if the output variable values have changed in
the coach since it started running. This method applies only when used in a data change event
handler. |
| tw.system.coachUtils.hasLocallyChangedPrivateVars() | Returns true if the private variable values have changed in
the coach since it started running. This method applies only when used in a data change event
handler. |
| tw.system.coachValidation | The validation results for variables that are bound to views in a coach of this client-side human service. |
| tw.system.coachValidation.addValidationError(variableName, errorMessage) | Adds an error message for a bound variable to the list of validation errors.
If the list already contains a message for the variableName, the message will be
replaced.
|
| tw.system.coachValidation.clearValidationErrors() | Removes all the validation errors from the list. |
| tw.system.coachValidation.populateFromBOSaveFailedError(boSaveFailedError) | Extracts the error messages for each property in the given BOSaveFailedError and adds them to the list of validation errors. If there are multiple validation messages for a particular property, the last one in the list is used. |
| tw.system.coachValidation.removeValidationError(variableName) | Removes the validation error for the provided variable name, if a validation error exists. |
| tw.system.coachValidation.updateValidationErrorMessage(variableName, errorMessage) | Updates the validation error for the variable name that is provided with the
new error message.
|
| tw.system.coachValidation.validationErrors | The list of validation errors for bound variables. Updates to the list must be made through the functions of tw.system.coachValidation. |
| tw.system.dataChangeUtils | Utility functions that you use to work with data updates from the server. This method applies only when used in a data change event handler. |
| tw.system.dataChangeUtils.applyAllIncomingVars() | Applies the values of all the variables updated on the server to the client. This method applies only when used in a data change event handler. |
| tw.system.dataChangeUtils.applyIncomingVar(variableName) | Applies the value of the variable updated on the server to the client. This method applies only when used in a data change event handler. |
| tw.system.dataChangeUtils.getIncomingVars() | Returns an object that contains the variables with values updated on the server that have not yet been applied to the client. This method applies only when used in a data change event handler. |
| tw.system.processApp | The workflow automation or toolkit that contains the client-side human service. |
| tw.system.processApp.acronym | The acronym of the workflow automation or toolkit that contains the client-side human service. |
| tw.system.processApp.id | The identifier of the workflow automation or toolkit that contains the client-side human service. |
| tw.system.processApp.name | The name of the workflow automation or toolkit that contains the client-side human service. |
| tw.system.processApp.snapshot | The version of the workflow automation or toolkit that contains the client-side human service. |
| tw.system.processApp.snapshot.id | The identifier of the workflow automation or toolkit version that contains the client-side human service. |
| tw.system.processApp.snapshot.name | The name of the workflow automation or toolkit version that contains the client-side human service. This variable applies only if the version is a named version. |
| tw.system.processInstance | The process instance in which this client-side human service runs. This variable applies only if the client-side human service runs in a process instance. |
| tw.system.processInstance.atRiskDate | The date when this process instance is considered at risk of being overdue, provided as a JavaScript Date object |
| tw.system.processInstance.caseFolderId (deprecated) | Deprecated. Use processInstanceFolderId
instead. The identifier of the folder that is associated with the process instance in which this client-side human service runs. This variable applies only when the client-side human service runs in a process instance. |
| tw.system.processInstance.caseFolderServerName (deprecated) | Deprecated. Use processInstanceFolderServerName
instead. The name of the server associated with the instance in which this client-side human service runs. |
| tw.system.processInstance.dueDate | The date when this process instance is due to be completed, provided as a JavaScript Date object. |
| tw.system.processInstance.processInstanceFolderId | The ID of the case folder associated with the process instance. It replaces the deprecated caseFolderId. |
| tw.system.processInstance.processInstanceFolderServerName | The name of the server associated with the process instance case folder. It replaces the deprecated caseFolderServerName. |
| tw.system.processInstance.id | The identifier of the process instance in which this client-side human service runs. |
| tw.system.processInstance.name | The name of the process instance in which this client-side human service runs. |
| tw.system.processInstance.parentCase.caseId | The parent case identifier that is associated with the process instance. |
| tw.system.processInstance.parentCase.caseServerId | The identifier of the server associated with the parent case instance. Not intended to be displayed to end users. |
| tw.system.processInstance.parentCase.parentActivityId | The parent activity identifier that is associated with the process instance. |
| tw.system.processInstance.process | The process for the process instance in which this client-side human service runs. |
| tw.system.processInstance.process.description | The description of the process for the process instance in which this client-side human service runs. |
| tw.system.processInstance.process.name | The name of the process for the process instance in which this client-side human service runs. |
| tw.system.processInstance.processApp | The workflow automation or toolkit that contains the process instance in which this client-side human service runs. |
| tw.system.processInstance.processApp.acronym | The acronym of the workflow automation or toolkit that contains the process instance in which this client-side human service runs. |
| tw.system.processInstance.processApp.id | The identifier of the workflow automation or toolkit that contains the process instance in which this client-side human service runs. |
| tw.system.processInstance.processApp.name | The name of the workflow automation or toolkit that contains the process instance in which this client-side human service runs. |
| tw.system.processInstance.processApp.snapshot | The version of the workflow automation or toolkit that contains the process instance in which this client-side human service runs. |
| tw.system.processInstance.processApp.snapshot.id | The identifier of the workflow automation or toolkit version that contains the process instance in which this client-side human service runs. |
| tw.system.processInstance.processApp.snapshot.name | The name of the workflow automation or toolkit version that contains the process instance in which this client-side human service runs. This variable applies only if the version is a named version. |
| tw.system.processInstance.startDate | The date when this process instance started, provided as a JavaScript Date object. |
| tw.system.processInstance.startingDocumentId | The identifier of the document that started the process instance in which this client-side human service runs. |
| tw.system.processInstance.startingDocumentServerName | The name of the server that contains the document that started the process instance in which this client-side human service runs. |
| tw.system.processInstance.task | The task in the process instance in which this client-side human service runs. |
| tw.system.processInstance.task.atRiskDate | The date when this task is considered at risk of being overdue, provided as a JavaScript Date object. |
| tw.system.processInstance.task.dueDate | The date when this task is due to be completed, provided as a JavaScript Date object. |
| tw.system.processInstance.task.enablingDocumentId | The identifier of the document that enabled the process instance in which this client-side human service runs. |
| tw.system.processInstance.task.enablingDocumentServerName | The name of the server that contains the document that enabled the user task activity in the process that this client-side human service implements. |
| tw.system.processInstance.task.id | The identifier of the task in the process instance in which this client-side human service runs. |
| tw.system.processInstance.task.narrative | The descriptive narrative for the task in the process instance in which this client-side human service runs. The narrative is visible in Workplace. |
| tw.system.processInstance.task.originator | The name of the user who originated this task. This is either the previous owner of the task or the user who launched the process instance. |
| tw.system.processInstance.task.owner | The name of the user who is assigned to this task. |
| tw.system.processInstance.task.priority | The task priority that is specified as a string value. It can take one of the following values: Lowest, Low, Normal, High, Highest. |
| tw.system.processInstance.task.priorityValue | The task priority that is specified as an integer value. It can take one of the following values: 50, 40, 30, 20, 10. |
| tw.system.processInstance.task.processActivityDescription | The description of the process activity that is associated with the task. |
| tw.system.processInstance.task.processActivityRichDescription | The rich text description of the process activity that is associated with the task. |
| tw.system.processInstance.task.processActivityName | The name of the process activity that is associated with the task. |
| tw.system.processInstance.task.startDate | The date when this task started, provided as a JavaScript Date object. |
| tw.system.processInstance.task.startingDocumentId | The identifier of the document that started the process instance in which this client-side human service runs. |
| tw.system.processInstance.task.status | The task status that is specified as a string value. |
| tw.system.processInstance.task.subject | The descriptive subject for the task in the process instance in which this client-side human service runs. The subject is visible in Workplace. |
| tw.system.url.bpmDataEndpoint | The REST endpoint that is used to retrieve data related to tasks, dashboards, processes, and startable services. |
| tw.system.url.userInfoEndpoint | The REST endpoint that is used to provide user-profile information such as avatar, job title, and so on. See The context object. |
| tw.system.user | The owner of the task in the process this client-side human service implements. Otherwise, the user who initiated the client-side human service. |
| tw.system.user.baseTextDirection | A variable that controls the text direction. It is used for bidirectional language support. |
| tw.system.user.fullName | The full name of the task owner, if this client-side human service is running in a process instance. Otherwise, the full name of the user who initiated the client-side human service. |
| tw.system.user.id | The identifier of the task owner, if this client-side human service is running in a process instance. Otherwise, the identifier of the user who initiated the client-side human service. |
| tw.system.user.locale | The user's locale, as specified in the user preferences. The value is provided as a string. |
| tw.system.user.localeDescription | A human-readable description of the user's locale. |
| tw.system.user.manages | An array of teams that are managed by this user. |
| tw.system.user.manages[i].id | The identifier of a team that is managed by this user. |
| tw.system.user.manages[i].name | The name of a team that is managed by this user. |
| tw.system.user.manages[i].tkShortName | The toolkit acronym for a team that is managed by this user. |
| tw.system.user.name | The name of the task owner, if this client-side human service is running in a process instance. Otherwise, the name of the user who initiated the client-side human service. |
| tw.system.user.teams | An array of teams that this user is a member of. |
| tw.system.user.teams[i].id | The identifier of a team that this user is a member of. |
| tw.system.user.teams[i].name | The name of a team that this user is a member of. |
| tw.system.user.teams[i].tkShortName | The toolkit acronym for a team that this user is a member of. |
This topic is shared by BAW, CP4BA, CP4BASaaS. Last updated on 2025-03-13 12:15