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 default value for a reference field on Catalog form

rambabu1
Giga Expert

Hi,

i have a field on form it's reference field and i need to set default value for that field.

below is the script that i written in default value. but it's not working

find_real_file.png

 

14 REPLIES 14

don't give any default value.

When you click the lookup field did you check if user is able to see that record or not?

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

yes user able to see. but in the form i need hide that field and need to pass default value.

Hi,

then default value should work fine

OR

you can use onLoad client script and set the sysId and then hide that field

regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@rambabu 

Hope you are doing good.

Did my reply answer your question?

If my response helped please close the thread by marking appropriate response as correct so that it benefits future readers.

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hi,

Please make sure a record is available in reference table with this sys_id.

Also note that the default value will be set on new records only. It will not make any changes to existing records. You have to run background script to set Default values if the field is empty.

 

Thanks,
Anil Lande

Please appreciate the efforts of community contributors by marking appropriate response as correct answer and helpful, this may help other community users to follow correct solution in future.
Thanks
Anil Lande