Add Contact button- Can't get URL redirect to work

edited October 15, 2019 in Questions
I am trying to great a Global Action button that will redirect my users to the standard create new contact page in salesforce.  I can get the page to pull up fine, but I can't get the AccountID to pass into the Account field.

Here is my redirect URL:
/setup/ui/recordtypeselect.jsp?ent=Contact&retURL=%2F{{{$Model.Contact.data.AccountId}}}&save_new_url=%2F003%2Fe%3FretURL%3D%252F{{{$Model.Contact.data.AccountId}}}%26accid%3D{{{$Model.Contact.data.AccountId}}}

Any idea what could be wrong?

Comments

  • edited October 15, 2019
    you need to indicate the row number. If you only have one record in the model (like a detail page), then it is row 0. Modify your merges like this: {{{$Model.Contact.data.0.AccountId}}}
  • edited February 14, 2017
    Thanks Raymond.  That works except in the case where my contact model is empty (i.e. there aren't any contacts already associated with the account).  Any ideas for that?  

  • edited October 15, 2019
    If you aren't populating that parameter anyway, you should be able to just drop it out of the URL.
  • edited February 14, 2017
    I figured it out.  Had to run this as a run multiple actions button and re-query the model before my redirect.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!