Copy reference field value into string field

chanikya
Kilo Sage

i have Group field(reference)     in KB record so when i select the group name in KB record then that group name should be upadte in KB Group field(string type) of Approval table.

find_real_file.png

find_real_file.png

1 ACCEPTED SOLUTION

Hi Karthik,



Replace,


var one = current.u_group;


with


var one = current.u_group.getDisplayValue();




Thanks,


Maddy


View solution in original post

6 REPLIES 6

Prateek kumar
Mega Sage

Write an after business rule on the knowledge record table and update the approver table with the group field accordingly.



Please mark my response as correct and helpful if it helped solved your question.
-Thanks

Hi,



i have written script , but not working..




var one = g_form.getDisplayBox('group').value;


var approve=new GlideRecord('sysapproval_approver');


approve.addQuery(document_id, current.sys_id);


approve.query();


if(approve.next())


{


approve.u_kb_group=one;


approve.update();


}


See if this helps


Updated Script:


var one = current.group;


var approve=new GlideRecord('sysapproval_approver');


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


approve.query();


if(approve.next())


{


approve.u_kb_group=one;


approve.update();


}



g_form doesn't work server side.



Please mark my response as correct and helpful if it helped solved your question.
-Thanks

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


{



var one = current.u_group;


var approve=new GlideRecord('sysapproval_approver');


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


approve.query();


if(approve.next())


{


approve.u_kb_group=one;


approve.update();


}



})(current, previous);




Getting group sys_id, how can we display Group name here instead of     " Group sys_id"


find_real_file.png