How to display contact info in field editor when related contact is selected as a lookup on another models field edior

  • 1
  • Question
  • Updated 3 years ago
  • Answered
I have got 2 models Application and Contact , where Contact is a lookup to application.On Application field editor having 2 fields 1 - New Borrower 2. Contact Reference

  
If a user selected any contact from lookup or user selects new borrower then a new Contact field editor will be displayed.

  We need it like if a Existing contact is selected form Lookup on Application Field Editor's Contact reference, the related contact information should get filled up in below contact field editor. We have created a condition on Contact saying Id=Application.Contact's Id. But this is still showing empty pane. 

  Is there any approach to re-render this Contact panel and show data of the selected contact's details on lookup.
Photo of rajasekhar reddy

rajasekhar reddy

  • 282 Points 250 badge 2x thumb

Posted 3 years ago

  • 1
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
A couple options exist here. 

1. Put the field editor on same model.  Go through the lookup and add the contact data to the model.  In the lookup field's search properties add those fields to what is queried when the lookup is selected.  (You do not need to include the fields in the search table,  just make them queried).   This will populate the contact detail fields when the lookup is selected.   Downside:  Fields will not be editable. 

2. Add a condition to your contact model on the id field that is filterable default off. 
Add a model action to the Action that fires when the contact field is updated. 
That action should update the condition you created on the contact model with the {{ContactId}} selected in the contact.  Then it should requery the model.

 (This is where you went wrong above.  It doesn't look like you were updating the condition when you selected a new contact in the lookup.  This will not happen automatically) 

This will refresh the contact model and when values are detected,  the Field editor will render.   These results will be editable. 
Photo of Joe Ort

Joe Ort

  • 2,256 Points 2k badge 2x thumb
Never knew you could run actions based on a field being updated - that's magical...
Photo of rajasekhar reddy

rajasekhar reddy

  • 282 Points 250 badge 2x thumb
@rob thank you , this worked amazing 
Photo of Anna Wiersema

Anna Wiersema

  • 10,890 Points 10k badge 2x thumb
@Joe - It's been way too long in coming, but we finally have an article on Model Actions that talks about all the different possibilities and gives some example applications, published yesterday.