I am aware that there is a way to update Classic UI pages without saving through adding specific code to the schema as I have seen it work before, but I am having trouble understanding how to do the same on a Freedom UI page.
Specifically, I would like to automatically fill out fields when a lookup option is chosen. An example of this working on the Classic UI is on the application forms page in the Finserv Sales and Service package, where a contact's information is filled in on the application whenever a contact is chosen (see the screenshot below).
I thought it would be a good exercise to try to update the page to Freedom UI so I would know it was working correctly, but I have not figured anything out so far.
Any and all help is appreciated!
Like
There are two approaches you can take:
Approach 1 (minimal code):
- Make sure that live data updates is turned on for the object.
- On a change of the lookup, save the record. You'll need code for this to respond to the lookup change and then to save the record.
- Create a process that triggers on the save of the record, it then updates the record to populate the other fields
Approach 2 (more code, but no save is needed, user can still cancel)
- On a change of the lookup add code to listen and respond to the lookup change
- Read the selected lookup value and use a model query to read the associated lookup data and set the values on the page
Ryan
There are two approaches you can take:
Approach 1 (minimal code):
- Make sure that live data updates is turned on for the object.
- On a change of the lookup, save the record. You'll need code for this to respond to the lookup change and then to save the record.
- Create a process that triggers on the save of the record, it then updates the record to populate the other fields
Approach 2 (more code, but no save is needed, user can still cancel)
- On a change of the lookup add code to listen and respond to the lookup change
- Read the selected lookup value and use a model query to read the associated lookup data and set the values on the page
Ryan
Ryan Farley,
Just to clarify, the second approach does not require saving the record, and the first step of that method saying "save the record" was just because the text was copied from the first approach, correct?
The use case I have makes it impossible to save the record to update the data on the page, as some of the information that will be filled in is required information and can't be saved if it is empty. Manual entry is possible, of course, but we are trying to minimize human error in our implementation.
Alexander,
Yes correct, that was a copy/paste mistake. On the second approach no save is needed (I updated the text).
You're basically just listening for the change of the lookup, then once a value is selected, you do a query to read the associated record and populate the controls/fields on the screen.
One last approach is, if you don't really need the values from the related record to be editable and only displayed, is to simply bind the fields from that record on the page. Freedom pages will allow you to add controls on the page, not bound to a column of the object, and then select the binding from some related record. This will display them, but they will not be editable, and will not actually exist on the current record - only being displayed from the related record.
Ryan