The CreatorCon Call for Content is officially open! Get started here.

Pass Variables to Catalog Task Short Description

WP2
Kilo Guru

Hi All,

I need the Task short description to display depending on the "Type of Request" selected. The requirement is to ensure that both the "type of request" selected, the second variable + requestor's name reflect in the "Task short description". 

Only need one to show in the task short description depending on the "type of request" NOT all three at once 

See code below: How can I add the code to my catalog task activity and have it showing correctly in the Task Short description depending on the "type of request"?

task.short_description = current.variables.type_of_request + " - " + current.variables.alpha + " - " + current.variables.requested_for.name.toString();

task.short_description = current.variables.type_of_request + " - " + current.variables.bravo + " - " + current.variables.requested_for.name.toString();

task.short_description = current.variables.type_of_request + " - " + current.variables.charlie + " - " + current.variables.requested_for.name.toString();

Thank you for your help.

1 ACCEPTED SOLUTION

Hi,

Can you share the script here?

sample script here; ensure you use proper value to compare from the type_of_request variable

var typeOfRequest = current.variables.type_of_request;

if(typeOfRequest == 'A'){
task.short_description = typeOfRequest + " - " + current.variables.alpha + " - " + current.variables.requested_for.name.toString();
}
else if(typeOfRequest == 'B'){
task.short_description = typeOfRequest + " - " + current.variables.bravo + " - " + current.variables.requested_for.name.toString();
}
else if(typeOfRequest == 'C'){
task.short_description = typeOfRequest + " - " + current.variables.charlie + " - " + current.variables.requested_for.name.toString();
}

Mark Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

12 REPLIES 12

@Sathwik 

I have replied to your similar question with my comment

please check and mark appropriate response as correct and helpful

Short description is missing which is configured on catalog task

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Angshuman3
Mega Guru

Hi Rich,

Check if the below code works :-

if(current.variables.type_of_request == 'Name of the 1st type Request'){
task.short_description = current.variables.type_of_request + " - " + current.variables.alpha + " - " + current.variables.requested_for.name.toString();
}
else if(current.variables.type_of_request == 'Name of the 2nd type Request'){
task.short_description = current.variables.type_of_request + " - " + current.variables.bravo + " - " + current.variables.requested_for.name.toString();
}
else if(current.variables.type_of_request == 'Name of the 3rd type Request'){
task.short_description = current.variables.type_of_request + " - " + current.variables.charlie + " - " + current.variables.requested_for.name.toString();
}

 

Hope this helps.

Mark the answer as correct/helpful if you are satisfied.

Thanks,
Angshuman

Thank you for your help