how to set reference variable value from another table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-09-2023 11:38 PM - edited 08-09-2023 11:45 PM
Hi Team,
I need to set value in reference variable from the mtom table using business rule. I have tried client scrip it is setting the value but, I also need to use that reference value in flow, it is showing empty, due to that I go for BR. Please suggest.
(function executeRule(current, previous /*null when async*/) {
var reqSYSID = current.sys_id;
var gr = new GlideRecord('sc_item_option_mtom');
gr.addQuery('request_item.number',reqSYSID );
gr.addQuery('sc_item_option.item_option_new','a4d0a2efdb5b69108935e786059619e3');
gr.query();
if(gr.next()){
var serviceID = gr.sc_item_option.value.getDisplayValue();
current.variables.ABC = serviceID; // reference variable
current.update();
}
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-10-2023 12:00 AM
BR is on which table?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-10-2023 12:02 AM
Hi Ankur,
BR is on sc_req_item table.
After insert
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-10-2023 01:29 AM
I agree to the point mentioned by Sandeep.
Why to copy same info into another variable?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-10-2023 12:04 AM
@Ash41 If value is present in one variable of request item then why do you want copy the same value in another variable unless you are doing any modification into that value.