2017年8月1日 星期二

[ServiceNow] Print All Variables and values of a requested item

gs.info('Print Request Item Var start'); var item = new GlideRecord("sc_req_item"); item.addQuery("sys_id", '0c7906b5db5003009bdb5740cf961978'); item.query(); if (item.next()) { gs.info('Print Request Item Var '+item.sys_id); // grab all variable sets from the parent request var var_own = new GlideRecord('sc_item_option_mtom'); var_own.addQuery('request_item', item.sys_id); //var_own.addQuery('sc_item_option.item_option_new.u_approval_display', 'global'); var_own.orderBy('sc_item_option.item_option_new.order'); var_own.query(); if (var_own.next()) { gs.info(var_own.sc_item_option.item_option_new.question_text + ": " + eval('item.variable_pool.'+var_own.sc_item_option.item_option_new.name+'.getDisplayValue()') + "\n" ); } }

沒有留言:

張貼留言