Prepopulate Account Name in Custom New Contact Page

  • 3
  • Question
  • Updated 5 years ago
  • Answered
  • (Edited)
Ok so, when you're on an account page and you click "Add Contact," on the new Contact form it should auto populate the the Account field with the name of the account. This normally goes through URL parameter, I think, but if your New Contact page is a Skuid page, the override takes over the url parameter... so how do you do the "New Contact" redirect so that the new contact will be automatically associated with the Account?
Photo of Anna Wiersema

Anna Wiersema

  • 10,890 Points 10k badge 2x thumb

Posted 6 years ago

  • 3
Photo of Zach McElrath

Zach McElrath, Employee

  • 49,056 Points 20k badge 2x thumb
Official Response
1. Add a "New Contact" Global Action to the Contacts table on your Account's detail page.

This should be a "Redirect" action whose URL takes you to the New Contact page, and passes in the Id of the current Account. Usually you can get this Id from your page's URL parameters, but you could also get it from a model merge:

URL (easiest way --- use URL Parameter to get Account Id):
/{{Model.KeyPrefix}}/e?retURL=%2F{{$Param.id}}&accid={{$Param.id}}


URL (more complex --- use global model merge to get Account Id):
/{{Model.KeyPrefix}}/e?retURL=%2F{{#$Model.AccountData.data}}{{Id}}{{/$Model.AccountData.data}}&accid={{#$Model.AccountData.data}}{{Id}}{{/$Model.AccountData.data}}






2. Create a custom Skuid page to use as the "NewContact" page
This page should expect to be handed an "accid" URL parameter, and it should use this in an "Account" model. You should then have a "Contact" model which has a Model Merge condition to autopopulate the "AccountId" field using the Account model:

(2a) Create an Account Model.
-Fields: Id, Name
-Conditions: Id = (param) accid





(2b) Create a Contact Model
-Fields: all the fields you want the user to edit when creating a new Contact
-Conditions: AccountId = (Account)(Id)



3. Tada! The AccountId field will be prepopulated on your NewContact page, and it will display as the Account's Name: