Display Reference field values based on Choice field

Nagashree5
Tera Contributor

Hi All,

 

I have a field called choose ERP which has dropdowns as SAP and GEOS.

There is another field called Entity Name which refers to a custom table. The custom table consists these columns that is Business, SAP and GEOS. 

The requirement is if the user selects SAP in ERP field, the Entity Name field should show only the Business which have SAP values(The condition will be SAP is not empty for the Business).

And if the user selects GEOS in ERP field, the Entity Name field should show only the Business which have GEOS values(The condition will be GEOS is not empty for the Business).

 

Can anyone guide me on this.

1 ACCEPTED SOLUTION

Siva Jyothi M
Mega Sage

Hi Nagashree,

 

Can you try below:

 

javascript:
var erp = current.variables.u_erp;
if (erp == 'SAP')
  'u_sap!=NULL';
else if (erp == 'GEOS')
  'u_geos!=NULL';

SivaJyothiM_0-1700817323486.png

 

 

Please mark this answer as correct and helpful if it solves your issue.

Regards,

Siva Jyothi M.

View solution in original post

4 REPLIES 4

Abbas_5
Tera Sage
Tera Sage

Hello @Nagashree5,
Please refer to the below link:
https://www.servicenow.com/community/itsm-forum/how-to-display-reference-field-values-based-on-choic...

 

Mark my correct and helpful, if it is helpful and please hit the thumbs-up button to mark it as the correct solution.
Thanks & Regards,
Abbas Shaik

Tai Vu
Kilo Patron
Kilo Patron

Hi @Nagashree5 

You can set the reference qualifier in the Entity Name field to achieve it.

Sample.

javascript:(current.u_erp == 'SAP') ? 'u_sapISNOTEMPTY' : (current.u_erp == 'GEOS') ? 'u_geosISNOTEMPTY' : 'sys_id=-1';

TaiVu_0-1700723089341.png

 

Replace u_erp, u_sap and u_geos with your field names.

 

Cheers,

Tai Vu

 

Siva Jyothi M
Mega Sage

Hi Nagashree,

 

Can you try below:

 

javascript:
var erp = current.variables.u_erp;
if (erp == 'SAP')
  'u_sap!=NULL';
else if (erp == 'GEOS')
  'u_geos!=NULL';

SivaJyothiM_0-1700817323486.png

 

 

Please mark this answer as correct and helpful if it solves your issue.

Regards,

Siva Jyothi M.

manjusha_
Kilo Sage

@Nagashree5 

 

In your custom table do you have any field which holds value SAP or GEOS

If yes then you need to create a script include and call it in your reference qualifier

Thanks,

Manjusha Bangale