Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Display reference field value into string fields

Kishore8
Kilo Guru

My script is not working:

var one = current.u_group.getDisplayValue();

var gr=new GlideRecord('sysapproval_approver');

gr.addQuery('document_id', current.sys_id);

gr.query();

if(gr.next())

{

gr.u_kb_group=one;

gr.update();

}

find_real_file.png

25 REPLIES 25

Can we try with after insert BR on sysapproval_approver table with below code.



(function executeRule(current, previous /*null when async*/) {


var gr = new GlideRecord('kb_knowledge');


gr.get(current.sysapproval);


current.u_kb_group = gr.getDisplayValue('u_group');


})(current, previous);



with Condition


find_real_file.png


Hi Shishir,




Thanks to your reply....!



I will check and get back to you


Hi shishir,



It is not working....!!!



Table: sysapproval



var gr = new GlideRecord('kb_knowledge');


gr.get(current.sysapproval);


current.u_kb_group = gr.getDisplayValue('u_group');




find_real_file.png






find_real_file.png


Can you put some logs and check if it logs anything



gs.log('INKB');


var gr = new GlideRecord('kb_knowledge');


gr.get(current.sysapproval);


gs.log('KB Number' + gr.number);


gs.log('u_group' + gr.getDisplayValue('u_group'));


current.u_kb_group = gr.getDisplayValue('u_group');


Not getting any result.



I think , when we change group value in KB record   that value should be copy into KBApproval table right.?