current.variables not working in business rule or background script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-14-2023 02:15 PM
So Im trying to get the sys id of a reference record inside a catalog item so to do a query inside a table with that sysid and return a value inside another variable on the opened ticket.
But I'm not getting the proper reference value or sysid from the variable, I know its the variable im not getting since when i script the sysid on the query it returns as espected...
Any ideas on what Im doing wrong??? I'm testing on background scripts
var current = new GlideRecord('sc_req_item');
current.get('f7f850b11b6875109dbded7be54bcbbd');
var perfil = current.variables.qual_perfil;
var gr = new GlideRecord ('u_m2m_access_profi_software_pac');
gr.addQuery('u_access_profile','3a082d0f1b0e89109dbded7be54bcb96');
gr.query();
gs.log('perfil '+ perfil);
if(gr.next()) {
gs.log('registro ' + gr.u_access_profile.u_profile);
// current.variables.hidden_grupo_ad = gr.u_access_profile.u_profile;
}
else gs.log ("erro")
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-14-2023 02:18 PM
Even more simple, its not working, returns undefined :