Prepopulate Account Name in Custom New Contact Page

  • 3
  • Question
  • Updated 6 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, Official Rep

  • 10,920 Points 10k badge 2x thumb

Posted 7 years ago

  • 3
Photo of Zach McElrath

Zach McElrath, Employee

  • 54,246 Points 50k 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):

URL (more complex --- use global model merge to get Account Id):

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: