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.

Update the short description on SCTASK

mallikabhupathi
Tera Expert

All, 

 

I have a requirement to update the SCTASK short description.

 

I have a field called "Request Type" which has three dropdown options to choose from - 1. Request new vendor 2. Modify existing Vendor 3. Terminate existing vendor.

When any one is selected, the short description should be "Vendor Remote Access: New/Modify/Terminate" for (Vendor name). 

 

This is working fine. However, the option "Modify existing vendor" has multiple checkboxes. 

When Modify is selected, I need to get the short description as Vendor Remote Access: [Modify -Type of Modification(s)] for Vendor. 

How can this be achieved?

 

Thanks,

Mallika

 

5 REPLIES 5

You can use a script something like the below:

 

var checkboxArr = [ 'checkbox_variable_1', 'checkbox_variable_2', 'checkbox_variable_3', 'checkbox_variable_4']; //replace with your varaible names
var selectedAccess = [];
for(var i = 0 ; i < checkboxArr.length; i ++)
{
	if( current.variables[checkboxArr[i]] == 'true' )
	{
		selectedAccess.push( current.variables[checkboxArr[i]].getLabel());
	}
}

if(selectedAccess.length > 0)
{
	current.setValue('short_description', 'Vendor Remote Access: ' + selectedAccess.join(',') + " for Vendor");
}

Note this is just an example, you will need to adjust it.