How to add multiple check box values if True to a Task Short Description
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-01-2022 07:12 AM
I have a MVRS that contains a label + multiple check boxes and another multiline text field.
I need to capture value of checkboxes if true into the Task short description. The user has the ability to select multiple checkboxes so the Task short description can for example read as Pre - Validation of (Value of checkbox or multiple checkboxes).
There are a total of 8 checkboxes in the Multi Row variable set.
I would rather not use a Record Producer. Am trying to script it as a part of the WF activity.
Would appreciate any help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-01-2022 07:30 AM
@KS13 Please write the below code in record producer script section
var shortDesc = "Pre - Validation of ";
if(producer.test_var_set.checkbox_1[0] == "true"){
shortDesc += "Checkbox 1: "+producer.test_var_set.checkbox_1[0]+" ";
}
if(producer.test_var_set.checkbox_2[0] == "true"){
shortDesc += "Checkbox 2: "+producer.test_var_set.checkbox_2[0];
}
current.short_description = shortDesc;
Note:
test_var_set - variable set internal name
checkbox_1 - First check box name
checkbox_2 - Second check box name
You can change the variables with your variables
ServiceNow Community Rising Star, Class of 2023
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-01-2022 02:46 PM
Hi Jaheer,
Is there a way to script it in the Workflow activity?
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-01-2022 07:17 PM
Hi @KS13
You have record producer or catalog item?
Which task short description you are expecting to populate? I mean incident, Requested Item ...?
ServiceNow Community Rising Star, Class of 2023
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-05-2022 08:03 AM
It is for a catalog item.