+ Start a Discussion

New Custom Button that will populate the name with the name of the Parent Record

I have created a button call New Metric that I want to use to create a new record and to pre-populate the Name field. The object where the record is created is called RFP Metrics. RFP Metric is a Master-Detail relationship with an object called RFP Tracking. I am creating the record from the RFP Tracking record where RFP Metrics is a related list. The button uses OnClick Java script. Here is the code:

location.href = "a6t/e?Name={!RFP_Metrics__c.Related_RFP_Tracking__c}&CF00N70000003UZ6F={!RFP_Metrics__c.Related_RFP_Tracking__c}&CF00N70000003UZ6F_lkid={!RFP_Metrics__c.Related_RFP_TrackingId__c}&retURL={!RFP_Metrics__c.Link}"

It looks like the Name should populate the the Name of the related record. And because this is a Master-Detail relationship, it should populate the Related Record Id. When I click the button, a new record is created but nothing is populated. When I look at the URL after I clicked the button, it appears like this:


It removes all of the merge field information. I have looked all across the internet and I can't figure out why this isn't working.
James LoghryJames Loghry
This seems like a great candidate to be replaced by a Publisher action.  The one and only Salesforce Wizard has an excellent post on this topic: http://thewizardnews.com/2014/01/08/great-url-hack-meet-the-chatter-publisher-action/
Salesforce WizardSalesforce Wizard
There's a lot of good reasons to move to a publisher action. The big one is that URL hacks like this are not officially supportive by Salesforce and you can see the start of their demise with the Lightning Experience UI. URL Hacks don't work in the Lightning Experience.

The only downsides of using a publisher action is 1. You need to be using Chatter and 2. It creates the record vs taking them to an edit page and pre-filling the fields. That means any fields you want to user to modify needs to be on the publisher action layout.

Your only other option is to use visualforce but that's typically overkill for most use cases.
Thanks Guys, and yes I found out they weren't supported when I took this issue to Salesforce support.  I did just create the Chatter Action and it does work but it is a little clumsy with it just creating the record but not taking you there to edit it.  I know it is just a couple of click, but you know how users can be.  We also don't use Chatter hardly at all.  So even though it isn't supported in the future, it would be great if someone could help with this custom button.