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.

How to set value to reference field using sys_id

peshwen
Giga Contributor

Hi all,

I am having sys_id of company name and i want to set that company name to reference field using sys_id.So how to do it?Please anyone can tell?

25 REPLIES 25

I will try c) to check if my id is correct, thanks for the hint.


Indeed. Perhaps try hardcoding the sys_id of an incident on your code just for troubleshooting purposes.



Thanks,


Berny


Hi Wolfgang,



If you're trying to create a new record try using a .insert() instead of .update();



Thanks,


Berny


Hi,



Do you have any idea how set values to section fields?




i want to set value for assigment group ->   assignment group is under "assignment" section in incident form.


by using code its not working.



g_form.setValue('assignment_group', "Service Now");


peshwen
Giga Contributor

Hi Sowmyab,



If the assignment group is reference field try assigning sys_id of group.



g_form.setValue('assignment_group','sys_id');