How to set default value for a reference field on Catalog Item

depa
Tera Contributor

Hi,

i have a reference field service and it has always one record. My question is how can i preselect this value so as a default value on the portal? That i dont need to select it always?

 

Update: Its not a static value.

find_real_file.png

Thanks for your help.

1 ACCEPTED SOLUTION

Hi Depa,

use this then in the default value section

Note: I assume there is only 1 record in that table

Give your table name in the query of GlideRecord

javascript: getValue(); function getValue(){var gr = new GlideRecord('your_table_name'); gr.query(); if(gr.next()){return gr.sys_id;}}

find_real_file.png

Regards
Ankur

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

View solution in original post

14 REPLIES 14

Dhananjay Pawar
Kilo Sage

Hi,

Open that reference variable and set default value there.

Check attached screenshot.

find_real_file.png

Thanks,

Dhananjay.

Thanks for reply, this is not a static value.

Hi,

If not static then what value you want to set there.

What is your business requirement?

Hi Depa,

Are you saying the table being referred has only 1 value always & you want that to be auto populated?

Regards
Ankur

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