115. g_form.setValue() best practice usage for Reference Field
g_form.setValue() is one of the most commonly used client-side APIs 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 the server.
https://medium.com/@LearnITbyPrashant/115-g-form-setvalue-best-practice-usage-for-reference-field-85fc478f9651?source=rss-d005fc598f0a------2