Auto - populate the catalog item name in the particular custom variable in catalog item

VanishreeG
Tera Contributor

Hi,
How to auto populate the catlog item in the particular custom variable on RITM and catalog tasks

1 ACCEPTED SOLUTION

@VanishreeG 

Hope you are doing good.

Did my reply answer your question?

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

View solution in original post

4 REPLIES 4

Ankur Bawiskar
Tera Patron
Tera Patron

@VanishreeG 

you can use onLoad catalog client script + GlideAjax on your catalog item

Get the catalog item sysId from URL and query sc_cat_item table and return name and then set it

OR
you can use default value with script, I assume your variable is string type

javascript: var name; var gr = new GlideRecord("sc_cat_item");
gr.addQuery("sys_id", "catalogItemSysId"); // give your catalog item sysId here
gr.query();
if (gr.next()) {
   name = gr.name.toString();
}
name;

If my response helped please mark it correct and close the thread so that it benefits future readers.

 

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

@VanishreeG 

Hope you are doing good.

Did my reply answer your question?

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

@VanishreeG 

Hope you are doing good.

Did my reply answer your question?

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

@VanishreeG 

I believe you should mark this response as correct as it has the script

AnkurBawiskar_0-1746417305737.png

 

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