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 IBM Process 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.

Table 1. JavaScript system variables available in IBM Process Designer for client-side human service development
Variable Description
tw.system.processApp The process application or toolkit that contains the client-side human service
tw.system.processApp.id The identifier of the process application or toolkit that contains the client-side human service
tw.system.processApp.name The name of the process application or toolkit that contains the client-side human service
tw.system.processApp.acronym The acronym of the process application or toolkit that contains the client-side human service
tw.system.processApp.snapshot The snapshot of the process application or toolkit that contains the client-side human service
tw.system.processApp.snapshot.id The identifier of the process application or toolkit snapshot that contains the client-side human service
tw.system.processApp.snapshot.name The name of the process application or toolkit snapshot that contains the client-side human service. This variable applies only if this snapshot is a named snapshot.
tw.system.processInstance The process or case instance in which this client-side human service is running. This variable applies only if the client-side human service is running in a process or case instance.
tw.system.processInstance.id The identifier of the process or case instance in which this client-side human service is running
tw.system.processInstance.name The name of the process or case instance in which this client-side human service is running
tw.system.processInstance.atRiskDate The date when this process or case instance is considered at risk of being overdue, provided as a JavaScript Date object
tw.system.processInstance.dueDate The date when this process or case instance is due to be completed, provided as a JavaScript Date object
tw.system.processInstance.startDate The date when this process or case instance started, provided as a JavaScript Date object
tw.system.processInstance.caseFolderId The identifier of the case folder that is associated with the case instance in which this client-side human service is running. This variable applies only when the client-side human service is running in a case instance.
tw.system.processInstance.process The process or case type model for the process or case instance in which this client-side human service is running
tw.system.processInstance.process The process or case type model for the process or case instance in which this client-side human service is running
tw.system.processInstance.process.name The name of the process or case type model for the process or case instance in which this client-side human service is running
tw.system.processInstance.process.description The description of the process or case type model for the process or case instance in which this client-side human service is running
tw.system.processInstance.task The task in the process or case instance in which this client-side human service is running
tw.system.processInstance.task.id The identifier of the task in the process or case instance in which this client-side human service is running
tw.system.processInstance.task.subject The descriptive subject for the task in the process or case instance in which this client-side human service is running. The subject is visible in IBM Process Portal.
tw.system.processInstance.task.narrative The descriptive narrative for the task in the process or case instance in which this client-side human service is running. The narrative is visible in IBM Process Portal.
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.startDate The date when this task started, provided as a JavaScript Date object
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.status The task status that is specified as a string value
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 or case instance.
tw.system.processInstance.task.owner The name of the user who is assigned to this task
tw.system.processInstance.task.startingDocumentId The identifier of the starting case document, if the client-side human service is running as a task in a case instance
tw.system.processInstance.task.enablingDocumentId The identifier of the enabling case document, if the client-side human service is running as a task in a case instance
tw.system.processInstance.task.processActivityName The name of the process activity that is associated with the task
tw.system.processInstance.task.processActivityDescription The description of the process activity that is associated with the task
tw.system.processInstance.processApp The process application or toolkit that contains the process or case type in which this client-side human service is running
tw.system.processInstance.processApp.id The identifier of the process application or toolkit that contains the process or case type in which this client-side human service is running
tw.system.processInstance.processApp.name The name of the process application or toolkit that contains the process or case type in which this client-side human service is running
tw.system.processInstance.processApp.acronym The acronym of the process application or toolkit that contains the process or case type in which this client-side human service is running
tw.system.processInstance.processApp.snapshot The snapshot of the process application or toolkit that contains the process or case type in which this client-side human service is running
tw.system.processInstance.processApp.snapshot.id The identifier of the process application or toolkit snapshot that contains the process or case type in which this client-side human service is running
tw.system.processInstance.processApp.snapshot.name The name of the process application or toolkit snapshot that contains the process or case type in which this client-side human service is running. This variable applies only if this snapshot is a named snapshot.
tw.system.user The task owner, if this client-side human service is running in a process or case instance. Otherwise, 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 or case instance. Otherwise, the identifier of the user who initiated the client-side human service.
tw.system.user.name The name of the task owner, if this client-side human service is running in a process or case instance. Otherwise, the name of the user who initiated the client-side human service.
tw.system.user.fullName The full name of the task owner, if this client-side human service is running in a process or case instance. Otherwise, the full name of 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.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.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
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.coachUtils.getLocallyChangedVars() Returns an array of variable names which have changed in the coach since it started running. This method applies only when used within 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 within 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 within 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 within a data change event handler.
tw.system.coachValidation The validation results for variables that are bound to coach views within a coach of this client-side human service
tw.system.coachValidation.validationErrors The list of validation errors for bound variables. Updates to the list must be done through the functions of tw.system.coachValidation.
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.
  • The variableName is the fully qualified variable (for example, tw.local.variable1).
  • The errorMessage is the message used by the coach view to indicate the validation error within the coach.
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.
  • Returns true if a validation error was updated.
  • Returns false if a validation error for the variable name does not exist.
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.clearValidationErrors() Removes all the validation errors from the list
tw.system.dataChangeUtils Utility functions that you use to work with data updates from the server. This method applies only when used within a data change event handler.
tw.system.dataChangeUtils.getIncomingVars() Returns an object that contains the variables with updated values on the server that have not yet been applied to the client. This method applies only when used within a data change event handler.
tw.system.dataChangeUtils.applyAllIncomingVars() Applies the values of all the updated variables on the server to the client. This method applies only when used within a data change event handler.
tw.system.dataChangeUtils.applyIncomingVar(variableName) Applies the value of the updated variable on the server to the client. This method applies only when used within a data change event handler.
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.constants.ECMServerNames Server names that can be used in Content Integration steps
tw.constants.ECMServerNames.IBM_BPM_CONTENT_STORE The server name for the IBM® BPM content store
tw.constants.ECMServerNames.IBM_BPM_DOCUMENT_STORE The server name for the IBM BPM document store