How to add multiple check box values if True to a Task Short Description

KS13
Tera Contributor

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. 

2 REPLIES 2

Jerick I
Kilo Sage
Kilo Sage

Hi @KS13,

 

Did you try this approach posted on the our community The secret of Multirow Variable Set – ServiceNow MRVS on Change (Part 2)

jaheerhattiwale
Mega Sage
Mega Sage

@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;

 

jaheerhattiwale_0-1669885017446.png

 

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.

 

Please mark the answer as correct or helpful based on impact
ServiceNow Community Rising Star, Class of 2023