- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-18-2023 12:10 PM
The behavior you're experiencing in the ServiceNow reference variable is probably due to how the ref_ac_columns and ref_ac_display_value attributes are configured.
By default, the ref_ac_display_value attribute is set to the value of the display_value column in the reference table. In your case, the display_value column is the country name, which is why the country name is displayed in the drop-down even though you have specified u_country_code and u_entity columns in the ref_ac_columns.
To display the entity value in the drop-down, you need to set the ref_ac_display_value attribute to the u_entity column. This will ensure that the entity value is displayed in the drop-down instead of the country name.
Attributes that you can use to configure the auto-complete behavior of a reference variable:
- ref_auto_completer: Specifies the auto-complete class to use. The default value is AJAXTableCompleter.
- ref_ac_columns: Specifies the list of reference table columns to display in the auto-complete drop-down. Separate column names with a semi-colon.
- ref_ac_columns_search: Specifies whether to search the reference table for matches when the user enters text in the auto-complete drop-down. The default value is true.
- ref_ac_display_value: Specifies the column name to use for the display value in the auto-complete drop-down. The default value is the value of the display_value column in the reference table.
By adjusting the ref_ac_display_value attribute to u_entity, you should see the desired entity value displayed in the reference variable drop-down.
Please, don't forget to mark my answer as correct if it solves your issue or mark it as helpful if it is relevant for you!
Regards,
Tushar