Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How to add Variable Set to Short Description of SCTASK in Workflow.

Cory Hitchings
Giga Guru

Hi there, 

I am looking to pull a Variable Set into the Short Description of an SCTASK.  I am able to bring variables in, however I have checkbox selections which were created in a variable set.  They are set to "when one is selected, the other options are disabled.  What I am hoping to achieve here is to show that Variable of the Variable Set to appear in the Short Description of the SCTASK.  

 

find_real_file.png

find_real_file.png

This is the workflow code I have but because it's a variable set, it doesn't work: 

 

workflow.scratchpad.findApproverTask = task.setNewGuid();

var str1 = "Supply Chain";

var obj = new c_getCatalogItemDetails();

str = obj.getDetails();

task.short_description = str1 +" - "+ current.cat_item.getDisplayValue()+" - "+current.variableset.checkbox_selections_sap_var.getDisplayValue();

task.description = str;

task.work_notes = str;

1 ACCEPTED SOLUTION

Mike Patel
Tera Sage

you need something like

var notes = '';

if(current.variables.po_pr_support_sap == 'true'){

notes += "PO/PR Support,";

}

if(current.variables.reporting_sap == 'true'){

notes += "Reporting,";

}

task.short_description = str1 +" - "+ current.cat_item.getDisplayValue()+" - "+ notes;

View solution in original post

2 REPLIES 2

Mike Patel
Tera Sage

you need something like

var notes = '';

if(current.variables.po_pr_support_sap == 'true'){

notes += "PO/PR Support,";

}

if(current.variables.reporting_sap == 'true'){

notes += "Reporting,";

}

task.short_description = str1 +" - "+ current.cat_item.getDisplayValue()+" - "+ notes;

Way too awesome, that did the trick.  Thanks so much Mike, I really appreciate it!