Preview is not available for a child reference field.

kritsharma
Kilo Contributor

Hi community,

I have a form where I want to autopopulate a reference field (Country/Location) in the child form using the value from a different reference field (Home Country/Location) from the parent form.

Home Country/Location is a reference to the core_country table, while Country/Location is a reference to the cmn_location table.

I'm able to pass the core_country value through a Script Include and Client Script, but when I set that value directly using g_form.setValue('location', pipeData.homeCountryLocation) , it populates the field value but shows "Preview not available" on the form.

I understand this is because the sys_id is from core_country, not cmn_location.

✅ What is the best way to match the core_country record to a cmn_location record (by country name or any other logic) and then populate the correct value into the Country/Location field on the child form so the preview works properly?


Thanks for help in advance
kriti

3 REPLIES 3

Sandeep Rajput
Tera Patron
Tera Patron

@kritsharma Except matching the Country name with the location name column in cmn_location there is no way you can get the sys_id of a cmn_location record.

What about preview is not available for that you have any other solution to auto populate the country/location and preview also available

@kritsharma Instead of returning the sys_id of the core_country record, you need to return the sys_id of a record from the cmn_location.