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

Anurag Tripathi
Mega Patron
Mega Patron

Just set the sys_id to reference field, it will work


-Anurag

Hi Anurag,


I tried but the value is not setting to field.Its empty only.



Thanks,


Nikhil


It can be set to a reference fields value using : g_form.setValue('your_fields_name', 'the sys_id of the field'); 

So it wouldn't work if you try to set it to a field that isn't a Reference type field.

Mihir Mohanta
Kilo Sage

write a on load client script.



use script :



g_form.setValue('NameOfTheCompanyField','paste_sys_id_here'); // provide the field name and sys_id in place of bold test.




Thanks,


Mihir