How to get sysid of added items to Order Guide using client script

reginabautista
Kilo Sage

Hi guys

 

Would anyone know how I could get the sysid of items added to an Order Guide using script? I have an Order Guide for New Hires which auto selects items for a new joiner depending on role. 

If a new joiner for example has a role of Operator, the items, Slack, ServiceNow, Confluence access etc. will be added to the Order Guide. I need to be able to auto populate the level of Access for these applications (catalog item level)

i.e.

 

In Order Guide, I have a variable called  Level of Access for Slack (slack_level_of_access)

In Slack Catalog item, I will populate the variable slack_level_of_access with whatever value I have set in Order Guide variable. (both variables have same name to be able to cascade value to catalog item)

Right now this is working but with hard-coded values (for demo purposes)

Basically, I would like to be able to loop through all the items in Order Guide, lookup the level of access table and use the catalog item sysid as key,  then populate the variables to be cascaded to the catalog items.

 

I couldn't find a way to do this from here or SNow documentation.

Any help is greatly appreciated.

find_real_file.png

Thanks

Regina

 

7 REPLIES 7

Hi,

It seems too difficult to get items sysids in that orderguide client script, even if you customize the order guide widget.

 

Will below work for you.

1) on change of Job role, it will cascade down to job role field on each catalogue items. Make job role field on catalogue items hidden if not wanted.

2) run onChange script on Job role field on Each catalogue item and put your above logic to fetch level of access and populate it

 


Mark my ANSWER as CORRECT / HELPFUL if it served your purpose.

Hi Bhagyashree, this actually was my initial approach. I am trying to avoid this route as I have to create a client script for each of the items. If there is no way to do this at Order Guide level I suppose this is the only way. 

 

Greatly appreciate you looking into this.

 

Thanks

Regina

hmm..I dont think servicenow provides anything on client script that we can use easily. There might be some hidden script include or API to fetch the items but its not worth putting that much effort just for this order guide.

And i would not recommend customizing order guide portal widget also.

I think you can go with doing this on individual item level and if you get more scenarios like this then its worth looking into better option.

 

Mark my ANSWER as CORRECT / HELPFUL if it served your purpose.