How to auto populate a reference field with non-static values?

  • 1
  • Question
  • Updated 8 months ago
  • Answered
Photo of Rijia

Rijia

  • 150 Points 100 badge 2x thumb

Posted 3 years ago

  • 1
Photo of Bill McCullough

Bill McCullough, Champion

  • 12,436 Points 10k badge 2x thumb
Rijia,

Would you please describe your use case.  I am not sure how to guide you.

Thanks,

Bill
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
I assume you want to pass the ID from a selected object into the reference field.  This is where merge syntax is perfect.  When you create,  or update the reference field - in the value section you can pass {{ObjectId}}

Look at this information about the different ways you can use merge syntax: 

http://help.skuidify.com/m/11720/c/71535
Photo of Rijia

Rijia

  • 150 Points 100 badge 2x thumb
Thanks for your reply guys. Following is  my scenario.

I have two objects, Application and Spouse, Spouse has a lookup on Application, Whenever I am creating a new Spouse record I have to link it with Application to indicate a particular Spouse is for a particular Application. To do so I have to choose Application ID each time I am creating a Spouse record which is not convenient. So, I want to auto populate Application ID field each time I am creating a new Spouse record.
Please help me with this scenario as I am new in Skuid.
(Edited)
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
If you are on an application page and are going to create a new spouse record you have a few options. 

1. You can create the spouse record on the same page - in a popup maybe.  The action that would open the popup would also create a new row in the spouse model,  and would pre-populate the row with Application value. 

2. You can create the spouse on a new page.  Add a URL parameter in the link to New Spouse and pass the Application ID in the URL.  On the new page create an Application model that has a condition reading the URL parameter and filters  applications accordingly.  

Then in your Spouse model,  add conditions to only show the Application ID that is in the Application model.  When creating new rows - conditions work to pre-populate the rows with your information. 

So now you get the Appliation you want in your new spouse record. 

Note:  You often have to pass both the Application ID and the Application Name into the new model (in both scenarios above) so that the user friendly name shows up instead of the 18 character number. 
Photo of Rijia

Rijia

  • 150 Points 100 badge 2x thumb
Thank you for your reply Rob. But it did not solve my problem. I think I was unable to explain what my scenario is. So here I am trying to explain my situation once again.

Spouse has lookup on Application and Contact. The create button on the left side of the page is redirecting to create contact page (if an applicant's Spouse's contact is already not created then he can use this button to create a contact of his spouse). If the contact of spouse already exists then applicant can choose his spouse("Spouse Name" field) and save it against the application as his spouse by choosing Application Name from lookup. So, I want to auto populate "Application"  field whenever I am saving a Spouse against an application. 
(While I am saving a Spouse against an Application, I am basically creating a record on Spouse object)
Attached is the screenshot of spouse object.
(Edited)
Photo of Bill McCullough

Bill McCullough, Champion

  • 12,436 Points 10k badge 2x thumb
Rijia,

Instead of redirecting when you create the contact, create a popup to enter the contact's detail.  For the 'Save' button, make sure it is set for multiple actions.  First save the newcontact model, then update the lookup field on the Spouse's record with the newcontact id.

Here is an example of the actions to run on the save button of the new contact popup.



Thanks,

Bill
Photo of Richa Sharma

Richa Sharma

  • 90 Points 75 badge 2x thumb
Hi @Rob,

Thanks for your answer.

It solved my query.

--
Thanks,
Richa Sharma