How to Display City Value from Location Table (Reference Field)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2024 09:48 PM
I have a Case with fields "Location" and "City," both referencing the Location table. I need the "City" field to display the City value from the Location table without changing the field type.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2024 10:32 PM
Hi @yana7,
We can directly get the city displayed along with location, without creating a new field.
As location is a reference field. We can get the 'City' field from location record to the Case Record.
- Open any case record and click on 'Additional actions' icon.
- Click Configure --> Form Layout.
- Select Location and click on Expand selected reference field icon.
Select the City field from 'Available' list and move it the 'Selected' list. Click 'Save'.
Mark the response correct and helpful if the answer assisted your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-08-2024 12:17 AM
Hello @yana7 ,
To achieve this please follow below steps :
1. Got to the table definition, in the Display Value column make sure no field is set to True i.e. every field available on form should have Display value to False.
2. Create onChange client script for both city and location field respectively and add the code as below.
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var ref = g_form.getReference('u_city'); //replace the backend name as per your use case for location and city
g_form.setValue('u_city','',ref.city);
}
I have tried this in my PDI and it is working for me.
If my answer solves your issue, please mark it as Accepted ✔️ and Helpful 👍based on the impact.
