UI Policy on reference field

G Balaji
Kilo Guru

Hello,

We've a reference field of List data type in our custom application. When user chooses "Other" as the value for this reference field, another field has to be shown up. Value list shown up in this field comes from another field. I could write UI policy to implement this. However, since it's a reference field, sys id is been used by SNOW. Since reference table data is populated by excel upload, sysid will change across the instances because of which UI policy won't work as expected. 

Is there anyways to use the label of the reference field in UI policy?

Thanks.

2 REPLIES 2

amlanpal
Kilo Sage

Hi Balaji,

 

You can use g_form.getDisplayValue('field_name') or g_form.getDisplayBox('field_name') to get the display value of the Reference field. As the SysID will be difference, you can fetch the Display Value of the field and perform your operation.

 

Hope this helps. Please mark Correct/Helpful based on the impact.

Sandeep Kumar6
Giga Guru

Hi Balaji,

 

I would suggest you to write OnChange client script for reference field.

Whenever it changes and value is other  show other field. Hide if value is anything apart from Other

Note:  While fetching value from referenced field make sure you are fetching display value not sys id then it will work in all instance.

Function. var xyz = g_form.getDisplayValue('<Field Name>');

but before that you have to hide that other filed on load using UI Policy or on load client script.

 

 

Please hit correct if this gave your answer.

Regards

Sandeep