Can I get the name of the catalog item that I am displaying in the service portal catalog item widget?

bonsai
Mega Sage

I want to display a button widget when viewing a specific catalog item in Service Portal.

 

If I can get the name of the catalog item, I would like to set it to the display condition of the button widget.

 

 

Is it possible to get the information of the catalog item displayed on the screen?

1 ACCEPTED SOLUTION

Mohith Devatte
Tera Sage
Tera Sage

hello ,

yes you can get it in server side of the widget 

you can use this method to get the sys_id of the catalog item and glide record to maintain items table and get the name of the catalog item like below 

data.catItemName="";
var gr = new GlideRecord('sc_cat_item');
gr.addQuery('sys_id',$sp.getParameter('sys_id'));
gr.query();
if(gr.next())
{
data.catItemName= gr.name;
}

Hope this helps 

please mark my answer correct if this helps you

View solution in original post

2 REPLIES 2

Mohith Devatte
Tera Sage
Tera Sage

hello ,

yes you can get it in server side of the widget 

you can use this method to get the sys_id of the catalog item and glide record to maintain items table and get the name of the catalog item like below 

data.catItemName="";
var gr = new GlideRecord('sc_cat_item');
gr.addQuery('sys_id',$sp.getParameter('sys_id'));
gr.query();
if(gr.next())
{
data.catItemName= gr.name;
}

Hope this helps 

please mark my answer correct if this helps you

Worked perfectly!
thank you!