Task
What is a Task
The Task resource describes an action that will occur once a Trigger's criteria is met. For example, on survey completion, a Task could execute a custom script.
Tasks are also called Actions.
If you would like to join the early access program for XM Solution Plugins, then please let us know by taking this survey.
This feature is in Early Access and is not yet generally available. Functionality, APIs, and documentation may change before general availability.
Context
The Task resource will generate three fields:
taskIdoutcomeIdcontextId
The taskId will be your Task's id (OCAC_***) and can be accessed with <step.id>.taskId.
The outcomeId will be your Task's associated Trigger's id (OC_***) and can be accessed with <step.id>.outcomeId.
The contextId is the context identifier for this Task. This is usually aSurveyid (SV_***) or
anOutcome id (OC_***) and can be called with <step.id>.contextId.
How to import it into an XM Solution
Using the XM Solution CLI
You can import a Task resource along with its associated Survey and Trigger using the CLI import command as long as the imported Survey is linked to the Trigger, and the Trigger is linked to the Task.
Start by running the following command:
solution import
Next a project category list should render. Select the basicSurvey option to view all potential Surveys to import:
1. AgileVideoDiscovery
2. BrandTracker
3...
11. basicSurvey
12...
Then a list of all your basic Survey projects will be displayed, and you can select one to import:
1. [basicSurvey] Survey1
2. [basicSurvey] Survey2
3. [basicSurvey] Survey3
4...
Now you should have your Survey project and all of its dependencies downloaded into a src/Resources_**** folder of your solution plugin. This will include any Task resources that are attached to your Survey project.
Solution Execution
Task resources are created using a "Create" step or updated using an "Update" step in the Solution Execution file.
{
"id": "task",
"type": "Create",
"config": {
"apiVersion": "task.v0",
"templateFilePath": "Resources_ab12/task.json",
"transformationFilePath": "Resources_ab12/modifyTask.js"
},
"dependencies": [
"survey",
"trigger"
]
}
The current apiVersion for Task resources is "task.v0".
Common / Required changes
Task resources will need their contextId, workspaceId, and outcomeId fields replaced with "{{ $.surveyStep.id }}", "{{ $.surveyStep.id }}", and "{{ $.triggerStep.id }}" respectively where surveyStep and triggerStep are the ids of the Survey and Trigger steps that this Task depends on.