Get the values of Variable editor of RITM

Najmuddin Mohd
Mega Sage

Hello Community,

I need to get all the values of the Variable editor of the RITM, which I am able to get using variable pool object.

But, the values are backend values, i.e., the backend value of choices, or the sys_id of the reference fields of the Catalog items. 
Now, I can't send these values to third party system with the backend values or the sys_ids of the reference fields. It's not even for one catalog item, where I can use current.variables.variable_name.getDisplayValue(). 

It should be like, I would like to have a script where I give the RITM sys_id, I get the variables values i.e., Display values.

Please feel free to add any input from your side. I want completely in a Key value pair, which I can sent to third party.

Regards,
Najmuddin.

@Dr Atul G- LNG  @Mark Manders @Runjay Patel @Kieran Anson @Sandeep Rajput @Anurag Tripathi  - Can you get me advise on this.

2 ACCEPTED SOLUTIONS

Kieran Anson
Kilo Patron

FYI - no need to tag us in your post.

My preferred option for this ask is to use the OOB script include which will return you an array of objects which you can then retrieve the values you wish

new global.GlobalServiceCatalogUtil().getVariablesForTask(ritmGR, withMRVS /*boolean*/)

View solution in original post

You need to pass the gliderecord object of the ritm instead of the sys_id.

e.g

var gr = new GlideRecord("sc_req_item");

gr.get("<sys_id_of_item">);

new global.GlobalServiceCatalogUtil().getVariablesForTask(gr, false)

 

 

View solution in original post

4 REPLIES 4

Kieran Anson
Kilo Patron

FYI - no need to tag us in your post.

My preferred option for this ask is to use the OOB script include which will return you an array of objects which you can then retrieve the values you wish

new global.GlobalServiceCatalogUtil().getVariablesForTask(ritmGR, withMRVS /*boolean*/)

Hi @Kieran Anson ,
Thank you for your response.

I have tried, but it returns an empty result.
I have passed the sys_id of the RITM, also tried with the sys_id of the sc_task.

NajmuddinMohd_0-1730738832160.png


Am I doing anything wrong ?

You need to pass the gliderecord object of the ritm instead of the sys_id.

e.g

var gr = new GlideRecord("sc_req_item");

gr.get("<sys_id_of_item">);

new global.GlobalServiceCatalogUtil().getVariablesForTask(gr, false)

 

 

Thank you @Deepak Negi 
It worked

 

NajmuddinMohd_0-1730739970209.png