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
11-30-2022 03:10 PM
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 did see a couple of solutions online, but they do not seem to be working.
Would appreciate any help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-30-2022 10:15 PM - edited 11-30-2022 10:44 PM
Hi @KS13,
Did you try this approach posted on the our community The secret of Multirow Variable Set – ServiceNow MRVS on Change (Part 2)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-01-2022 12:59 AM
@KS13 Please try the following code in record producer:
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:
variable set inter name = test_var_set
Checbox 1 name = checkbox_1
Checbox 2 name = checkbox_2
Replace these variables with your variables.
Please mark as correct answer if this solves your issue.
ServiceNow Community Rising Star, Class of 2023