• davidhbarber
  • NEWBIE
  • 0 Points
  • Member since 2011

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies
We have several RecordTypes for our Contacts.  For our "Study Contact" page layout, all the appropriate detail fields are there, and we have a related list that shows Contacts that the current Contact has referred to us.  I want to hide the default New button on this related list and replace it with a "New Referral" button.  Clicking the "New Referral" button should invoke the New action, but set the RecordType to "Study Contact" behind the scenes and bypass the "Select Contact Record Type" page.
 
I have looked everywhere for examples, and managed to put together the following... but it still shows the "Select Contact Record Type" page.   I am putting the RecordType parameter in the parameter array and also including it directly on the URL just in case....  Help?
 
Code:
//First construct the new URL
var newUrl = "{!URLFOR( $Action.Contact.NewContact, null,
[RecordType=Contact.RecordType,
CF00N70000002GKJz_lkid=Contact.Id,
con4_lkid=Account.Id,
retURL=$Request.retURL], true)}&RecordType={!Contact.RecordType}";
//Then redirect the user to it
window.parent.location.replace(newUrl);

This is run in an Execute Javascript button.
I have tried putting the RecordTypeId value in there directly too (rather than use Contact.RecordType), but to no avail.
I'm also trying to automatically link the new Contact with the referrer Contact, and trying to pre-populate the Account ID.
 
Thank you for your help,
Jeff