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.

PrashantLearnIT
Tera Sage

Hello Everyone,

 

g_form.setValue() is one of the most commonly used client side API in Service Now. While using it on reference or list fields, it is a best practice to pass the display value as the 3rd parameter along with its sys_id. Without a display value, the API makes an additional synchronous server call to fetch it and adds to the performance.

For Reference fields

g_form.setValue('caller_id', '5137153cc611227c000bbd1bd8cd2005', 'Fred Luddy');

For List fields

g_form.setValue('work_notes_list', '46d44a23a9fe19810012d100cca80666,681b365ec0a80164000fb0b05854a0cd', 'Beth Anglin, ITIL User');

Note: You will need to return the display value along with its sys_id when you fetch data from server.

 

If my content helped you in anyway, please mark this content as BOOKMARK, SUBSCRIBE & HELPFUL

 

Best Regards,

Prashant Kumar (LearnIT)

 

YouTube Channel LearnIT: https://www.youtube.com/@learnitwithprashant

Blog LearnIT: https://medium.com/@LearnITbyPrashant

Prashant Kumar LinkedIn: https://www.linkedin.com/in/learnitbyprashant/

ServiceNow Community Prashant Kumar - https://www.servicenow.com/community/user/viewprofilepage/user-id/19635

1 Comment