We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

Service Catalog Variables map to description field on Service Catalog Task

purdue
Kilo Sage

Hello,

I need to map variables to description on Catalog Task but I tried using scripted option but keeps erroring out.  What is the syntax for this.   Any assistance is appreciated.

Screenshot 2024-06-07 at 12.59.48 PM.png

Screenshot 2024-06-07 at 1.06.30 PM.png

1 ACCEPTED SOLUTION

Hi @purdue could you please also check the semicolon at the line 3. I missed it. it should be like below

var desc = [];

 

Let me know if it is working or will find another solution.

View solution in original post

22 REPLIES 22

If that's the case, then, of course, g_form won't be recognized since your flow is running on the server and g_form is a client side object.  You probably need to replace g_form with whatever name you gave the requested item record when calling the action.

Hope that helps.

:{)

Helpful and Correct tags are appreciated and help others to find information faster

sunilsargam
Kilo Sage

Hello @purdue ,

 

Could you please something like this?? 

var desc = []
desc.push(fd_data.1__get_catalog_variables("requested_for));
desc.push(fd_data.1__get_catalog_variables("manager));
desc.push(fd_data.1__get_catalog_variables("title));

return desc;

 

Mark this as helpful if it works. 

Will this fix the issue of populating the display value of selectbox?

Thanks,

Chad

Hello @purdue ,

 

To get display value of the variable, please user .getDisplayValue(). Since we are pushing everything in array and returning the array, it should work. 

 

var desc = []
desc.push(fd_data.1__get_catalog_variables("requested_for).getDisplayValue()); //example for displayvalue
desc.push(fd_data.1__get_catalog_variables("manager));
desc.push(fd_data.1__get_catalog_variables("title));

return desc;

 

 

Getting this error.

Screenshot 2024-06-11 at 1.38.22 PM.png