The Zurich release has arrived! Interested in new features and functionalities? Click here for more

How can I use g_form.addOption() for a reference field?

Smith Johnson
Tera Guru

Hello all,

I try to use g_form.addOption() for a reference field, but this does not seem to work. 

I have a reference field ("type") on portal. This field refers to cmdb_ci_appl table. Based on the role of the user, I want to add some more options to this field.

Any assistance on this would be so valuable for me.

 

Thank you in advance.

1 ACCEPTED SOLUTION

Willem
Giga Sage
Giga Sage

You cannot use g_form.addOption on reference field.

You have to add options/records to the table that is referenced and set up a reference qualifier if you want to limit the records that are shown accordingly.

View solution in original post

3 REPLIES 3

Willem
Giga Sage
Giga Sage

You cannot use g_form.addOption on reference field.

You have to add options/records to the table that is referenced and set up a reference qualifier if you want to limit the records that are shown accordingly.

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hi,

You can restrict or show values based on a reference qualifier. Details below.

https://docs.servicenow.com/bundle/paris-platform-administration/page/script/server-scripting/concep...

 

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Smith,

As already suggested you should use reference qualifier on your field to restrict the values to be shown.

refer below link for help

Advanced Reference Qualifier Using a Script Include

Regards
Ankur

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