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 would rather not use a Record Producer. Am trying to script it as a part of the WF activity. 

Would appreciate any help. 

5 REPLIES 5

jaheerhattiwale
Mega Sage
Mega Sage

@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

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

Hi Jaheer, 

Is there a way to script it in the Workflow activity? 

Thanks

 

 

Hi @KS13 

You have record producer or catalog item?

Which task short description you are expecting to populate? I mean incident, Requested Item ...?

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

It is for a catalog item.