Getting Variable Value from RITM using Item Option table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2023 09:54 AM
Looking for some help. I am just testing something and have a script to try and grab the variable values from an RITM.
//Just testing - RITM Sys ID
var ritmSysID = '413300509730ed10145b3b6e6253af31';
var gr = new GlideRecord('sc_item_option_mtom');
gr.addQuery('sc_item_option.item_option_new','e118bfd5db22bb00c53974dfaa96197a'); //Gap Owner Review Details Variable
gr.addQuery('request_item',ritmSysID);
gr.query();
if (gr.next()) {
alert("GAP OWNER REVIEW DETAILS: " + gr.sc_item_option.value);
}
I keep getting 'undefined' no matter what I try to do (and I've tried a lot). Now, if I add 'gr.request_item' in the Alert it returns the correct RITM SYS_ID so I know I am connected to the correct record. I just want to get the 'gap_owner_review_detail' variable value.
Any help?
Please mark this response as correct and/or helpful if it assisted you with your question.
Steven
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2023 10:11 AM
Have you tried doing the GlideRecord on the sc_req_item table, then using this syntax in your alert?
gr.variables.gap_owner_review_detail
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2023 10:11 AM
I have yes, but also returns undefined.
Please mark this response as correct and/or helpful if it assisted you with your question.
Steven
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2023 10:13 AM
Are you running this as a Fix Script, or ...?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2023 10:15 AM - edited 01-30-2023 10:18 AM
This is a Client Script and yes I know GlideRecord is not best practice there, but I am just testing something before going down the GlideAjax/Script Include path.
I even tried doing a callback function which gives me the RITM Sys ID, but doesn't allow me to see the variables.
var ritm = g_form.getReference('request_item',func);
function func(ritm)
{
if(ritm){
var ritmSysID = ritm.sys_id;
}
}
I still couldn't use ritm.variables.gap_owner_review_detail. I actually thought that would work as well to no avail.
Please mark this response as correct and/or helpful if it assisted you with your question.
Steven