How to display different column values on reference fields on a form?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
So, I have 3 fields on a catalog referenced to "cmn_location" as follows:
1. City
2. State
3. Country
Currently the "Name" field on the "cmn_location" table has the Display Value set as "True", but I need to show City, State & Country on the respective fields. Any possible method for this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
Hi @Sai_Dilip ,
You can use the Lookup Select box to show the choices from country, city and state field.
Thanks
Anand
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
Hi @Sai_Dilip ,
you can achieve with onChange Client script.
Field Name : select the primary variable which needs to be used to populate state, country fields. In script I mentioned city as primary variable based on which state and country is populated
you can adjust the code accordingly.
You can try with sample code:
function onChange(control, oldValue, newValue, isLoading) { // Exit if the form is loading or if no location is selected if (isLoading || newValue === '') { // Clear the other fields if the location is empty g_form.setValue('state', ''); g_form.setValue('country', ''); return; } // Get the referenced location record details asynchronously g_form.getReference('city', function(locationRecord) { // Check if a record was found if (locationRecord) { // Populate the state and country fields with the display values g_form.setValue('state', locationRecord.state.getDisplayValue()); g_form.setValue('country', locationRecord.country.getDisplayValue()); } }); }
If I could help you with your Query then, please hit the Thumb Icon and mark as Correct !!
Thanks, GP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
use ref_ac_columns in variable attribute
refer to the screenshot:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
if you don't want referenced field then you can user Lookup Select box as @ Anand2799 suggested