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.

Need to get variable values in task short description

Ashwini8
Tera Contributor

Hi All, We have a catalog item created and after submitted it will go for 2 levels of approval and once the approval is done it will create a task in the task the short description is mandatory field and in short description we need to get the catalog item name: requstedfor : user ID. we need this details in short description field. How to get these details please suggest.

 

 

1 ACCEPTED SOLUTION

Voona Rohila
Mega Patron
Mega Patron

Hi Ashwini

In your catalog task activity , use below code in script section.

var desc;

desc += "Item Name :"+current.cat_item.name;

desc += "Requested For :"+current.request.requested_for.getDisplayValue();

desc += "Requested For :"+current.request.requested_for.user_name;

task.short_description =desc;

 


Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP

View solution in original post

9 REPLIES 9

Voona Rohila
Mega Patron
Mega Patron

Hi Ashwini

In your catalog task activity , use below code in script section.

var desc;

desc += "Item Name :"+current.cat_item.name;

desc += "Requested For :"+current.request.requested_for.getDisplayValue();

desc += "Requested For :"+current.request.requested_for.user_name;

task.short_description =desc;

 


Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP

Thank you Rohila, Its working fine.

Hey just 1 small question I have a cmdb_ci field on catalog item ok and it should display only 1 perticuler value and user should not select any values from that field. so I made it manadatory but not getting how to display a single value in that. Do you have any input for this?

Hi Ashwini

You can add reference qualifier to your variable.

find_real_file.png


Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP

I tried adding name is --- but still its not displaying that value