Example of Activating Journey Tasks Based on Input to a Questionnaire
Let’s take a look at how you can activate a dependent task based on the response provided by the user to a specific question in a questionnaire.
This image illustrates the scenario when a task is activated based on the user's response to a specific question in a questionnaire.
![Activation of task based on response to questionnaire](images/per-activate-task-questionnaire.png)
Define a Value Set
To retrieve the response to a question in a questionnaire, you need to create a value set. This sample value set query retrieves the response to the Provide the reason why you are leaving this organization question in the Exit Survey questionnaire.
INPUTS ARE ALLOCATED_CHECKLIST_ID(number)
DEFAULT FOR L_ATTR IS 'C'
ELIGIBLE = 'N'
ALLOCATED_CHECKLIST_ID_STR = TO_CHAR(ALLOCATED_CHECKLIST_ID)
QUERY = 'XXX'
QUERY = '|=AllocatedChecklistId='''||ALLOCATED_CHECKLIST_ID_STR||''''
L_ATTR = GET_VALUE_SET('EXIT_REASON',QUERY)
IF L_ATTR = 'E' THEN
(
ELIGIBLE = 'Y'
)
ELSE
(
ELIGIBLE = 'N'
)
RETURN ELIGIBLE
INPUTS ARE ALLOCATED_CHECKLIST_ID(number)
DEFAULT FOR L_ATTR IS 'E'
ELIGIBLE = 'N'
ALLOCATED_CHECKLIST_ID_STR = TO_CHAR(ALLOCATED_CHECKLIST_ID)
QUERY = 'XXX'
QUERY = '|=AllocatedChecklistId='''||ALLOCATED_CHECKLIST_ID_STR||''''
L_ATTR = GET_VALUE_SET('EXIT_REASON',QUERY)
IF L_ATTR = 'C' THEN
(
ELIGIBLE = 'Y'
)
ELSE
(
ELIGIBLE = 'N'
)
RETURN ELIGIBLE
Activate Task Based on Questionnaire having Radio Button or Single Choice List as Response Type
Let's take a look at how you can activate a dependent task based on the response provided by the user to specific questions in a questionnaire. The response type for the questions is radio button or single choice list.
- Radio button
- Single choice list
Question Code | Question Text | Response Code | Description |
---|---|---|---|
5860 | I am feeling welcome here. | 8237 | Yes |
5860 | I am feeling welcome here. | 8238 | No |
The second question in the questionnaire asks users to rate their onboarding experience. This question has a single choice list as the response type. The 2 response options are Excellent, Average, and Bad. This table shows the response code for the 3 response options.
Question Code | Question Text | Response Code | Description |
---|---|---|---|
5870 | How would you rate your onboarding experience? | 8241 | Excellent |
5870 | How would you rate your onboarding experience? | 8242 | Average |
5870 | How would you rate your onboarding experience? | 8243 | Bad |
Based on the response to the first question, you can activate a couple of tasks. If the user answers Yes, you can ask them to fill a feedback form on how their first few days have been. If the user answers No, you can ask them to provide suggestions on how the process can be improved, so that they feel more welcomed. To do this, you need to create a value set.
Define a Value Set
To retrieve the response to a question in a questionnaire, you need to create a value set. This sample value set query retrieves the response to the question I am feeling welcome here in the Onboarding Survey questionnaire.
INPUTS ARE ALLOCATED_CHECKLIST_ID(number)
DEFAULT FOR L_ATTR IS '0'
ELIGIBLE = 'N'
ALLOCATED_CHECKLIST_ID_STR = TO_CHAR(ALLOCATED_CHECKLIST_ID)
QUERY = 'XXX'
QUERY = '|=AllocatedChecklistId='''||ALLOCATED_CHECKLIST_ID_STR||''''
L_ATTR = GET_VALUE_SET('FEELING_WELCOME_HERE',QUERY)
IF INSTR(L_ATTR, '8237', 1, 1) > 0 THEN
(
ELIGIBLE = 'Y'
)
ELSE
(
ELIGIBLE = 'N'
)
RETURN ELIGIBLE
The second sample formula checks the response to the same
question I am feeling welcome here in the seeded Onboarding
Survey questionnaire to activate other tasks. If the response to the question is No
(response code 8238), it activates the task where the user is asked to provide
suggestions on how the process can be improved, so that they feel more welcomed.
Note that the FEELING_WELCOME_HERE value set created in step 2 is used along with
the response code 8238 for No.INPUTS ARE ALLOCATED_CHECKLIST_ID(number)
DEFAULT FOR L_ATTR IS '0'
ELIGIBLE = 'N'
ALLOCATED_CHECKLIST_ID_STR = TO_CHAR(ALLOCATED_CHECKLIST_ID)
QUERY = 'XXX'
QUERY = '|=AllocatedChecklistId='''||ALLOCATED_CHECKLIST_ID_STR||''''
L_ATTR = GET_VALUE_SET('FEELING_WELCOME_HERE',QUERY)
IF INSTR(L_ATTR, '8238', 1, 1) > 0 THEN
(
ELIGIBLE = 'Y'
)
ELSE
(
ELIGIBLE = 'N'
)
RETURN ELIGIBLE
You can use the fast formulas while creating eligibility profiles. The fast formulas can then be used as activation criteria for the task to be activated based on the response to the questionnaire. Make sure that you set the Questionnaire task as the preceding task of the task to be activated.
You can use the same steps to create the value set and fast formulas for the second question which has single choice list as the response type. A new value set is needed for the second question because it has a different question ID. Other values in the fast formula, such as Value Set Name and Response Code can be used according to the response for which the fast formula is being written. Rest of the steps will be the same.