[SalesForce] URLFOR with custombutton

I want to create a custom button on parent record to add records in child object. I created the custom button with url for new child record on parent object but the parent name does not auto populate in the new child record edit mode and I have to enter it manually and then save the record. Is their a way to get this working.

Here is my code,

!URLFOR($Action.Rep_Expense__c.New,null,["00No0000000lFwWEAU"=Contact.Id],true)

Best Answer

I would recommend taking a look at a quick action vs using a custom button url hack since they do not work in Lightning experience and are not supported by salesforce and therefor could break without notice but if you want to continue with the URL hack then you need to change your paramaters to set both the id and the name and also include CF before the field ID for custom fields: {!URLFOR($Action.Rep_Expense__c.New,null,[CF00No0000000lFwWEAU=Contact.Id, CF00No0000000lFwWEAU_lkid=Contact.Name],true)}

Related Topic