UI Action - Story created from RITM - converting Variable values into description
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-26-2024 12:25 AM
Hi,
I am working on creating a UI Action that collects all data from a RITM record (variable names + values) and converts them into a story description.
There is a problem with RITM reference type variables, as the outcome is their sys_id's
The code i'm currently stuck on:
I believe I need to use glideajax call in the UI Action script and a Script Include to collect all the data, but have no clue how to do that.
Please assist.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-26-2024 12:51 AM
Hi @MikeLong ,
There is an OOB Script Include, where you pass the sys_id of the RITM, and you get Name and values of all the variables.
Below thread,
https://www.servicenow.com/community/itsm-forum/get-the-values-of-variable-editor-of-ritm/td-p/30957...
You get the Display data of the all the variables types.
If the above information helps you, Kindly mark it as Helpful and Accept the solution.
Regards,
Najmuddin.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-27-2024 03:54 AM
Thank you for your reply.
I tried to incorporate it into my script. While it works for text variables it still displays sys_ids in case of reference variables.
BR,
Michal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-27-2024 06:54 AM
Hi @MikeLong ,
When I try to run the script, I am able to get the Display values.
Check below script
var grRITM = new GlideRecord('sc_req_item');
grRITM.addQuery('sys_id','402e4b3ec34a12108dbffc0ed401318f');
grRITM.query();
if(grRITM.next()){
var community = new global.GlobalServiceCatalogUtil().getVariablesForTask(grRITM, true);
}
gs.info(JSON.stringify(community,null, 2));
Output:
*** Script: [
{
"label": "Location",
"display_value": "100 South Charles Street, Baltimore,MD, 1140 South Laredo Street, San Antonio,TX",
"visible_summary": true,
"multi_row": false,
"type": 21,
"value": "25ab9c4d0a0a0bb300f7dabdc0ca7c1c,25aba1df0a0a0bb300f3123f465fc7ff"
},
{
"label": "Requested ",
"display_value": "System Administrator",
"visible_summary": true,
"multi_row": false,
"type": 8,
"value": "6816f79cc0a8016401c5a33be04be441"
}
]
From the above, Location and Requested are reference values.
And the display_value from the JSON, gives the Display values of the records and value gives the sys_id.
You can write a top on script to fetch the display_value of each array.
If the above information helps you, Kindly mark it as Helpful and Accept the solution.
Regards,
Najmuddin.