For a reference type variable how to populate three field values
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-18-2023 08:11 AM
Hi all,
I created a variable on the portal which is a reference type of the cost center table without adding any conditions in the variable attributes section by default it is showing "country name". I wanted to show only two field values in the variable drop-down section which are entity and country from the same table. So, I have added the below condition in the variable attributes section
ref_auto_completer=AJAXTableCompleter,ref_ac_columns=u_country_code,u_entity,ref_ac_columns_search=true
However, after applying this condition also the variable showing the country name and country code but it is not showing the entity value.
Please provide the solution
thanks in advance
- 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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2023 07:20 AM
Hi Tushar,
I tried this in variable attributes section
ref_auto_completer=AJAXTableCompleter,,ref_ac_display_value=u_entity,ref_ac_columns=u_country_code,ref_ac_columns_search=true
but it is not working it is showing the table default display value field no matter what condition I apply..
I even tried this too
ref_auto_completer=AJAXTableCompleter,ref_ac_display_value=false,ref_ac_columns=u_country_code,ref_ac_columns_search=true
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2023 07:40 AM
can you please try below -
ref_auto_completer=AJAXTableCompleter,ref_ac_columns=u_country_code,u_entity,ref_ac_columns_search=true,ref_ac_display_value=u_entity
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2023 07:49 AM
not working