Helps you parse Workflow Manager tokens to the actual value of tokens in the job.
Tokens are placeholder text for dynamic properties that will be replaced at run time. For example, if you want to define an email message that will be sent automatically at certain times with job information and you want to add the id of the job to the message, you can add a placeholder token that will be replaced at run time with the value of job id.
The following types of embedded tokens are supported:
- Job Properties ([JOB:])
- Extended Properties ([JOBEX:])
- System ([SYS:])
- Functions
- Spatial Notification ([SN:])
- Environment Variable Parser ([ENV:])
For example:
- Parsing the token string "[JOB:ID] [JOB:ASSIGNED_TO] [JOB:START_DATE]" would return a result such as "401 demo 6/14/2017", where the job id is 401, it is assigned to demo user and the start date is 6/14/2017.
- Similarly, parsing the function token string "[EMAILOF(jbloggs)]" would return a result such as jbloggs@email.com, which is the value for user jbloggs email address.
Constructors
new TokenTask(properties)
properties Object See the properties for a list of all the properties that may be passed into the constructor. |
Property Overview
Name | Type | Summary | |
---|---|---|---|
String | The name of the class. more details | more details | |
Object | The options to be used for data requests. more details | more details | |
String | URL to the ArcGIS Workflow Manager REST service. more details | more details |
Property Details
declaredClassStringreadonly
The name of the class. The declared class name is formatted as
esri.folder.className
.requestOptionsObject
The options to be used for data requests. These options can also be controlled through the
requestOptions
method parameter.urlString
URL to the ArcGIS Workflow Manager REST service.
Method Overview
Name | Return Type | Summary | |
---|---|---|---|
Promise | Parses a string with embedded tokens using user and job information. more details | more details |
Method Details
parseTokens(params, requestOptions){Promise}
Parses a string with embedded tokens using user and job information. The string is returned with embedded tokens replaced by their actual values.
Parameters:params ObjectSee the object specifications in table below for the structure of the
params
object.Specification:jobId intA unique id for the job.
stringToParse StringThe string representing the tokens to be parsed.
user StringThe username of the user requesting token parsing.
optionalrequestOptions ObjectAdditional options to be used for the data request (will override requestOptions defined during construction).
Returns:Type Description Promise When resolved, returns the parsed string with the value of tokens. Example:var params = { jobId: 1501, stringToParse: "[JOB:ID] [JOB:ASSIGNED_TO] [JOB:START_DATE]", user: "cjones" }; tokenTask.parseTokens(params).then(function(parsedString){ // return a result such as "1501 Technicians 6/14/2017" console.log("parsedString = " + parsedString); });