1

I need to create a custom button that clone's a Lead record, and prepopulates all of the fields, EXCEPT that it needs to create it as a different record type. Here are a couple things I've tried for my url-hack-code, but neither work:

  1. /{!Lead.Id}/e?&RecordType=0121N0000012oypQAA&clone=1
  • this one "edits" the record and changes it to a new record type, but it is not doing my need of "creating new" record
  1. /lightning/o/Lead/new?recordTypeId=0121N0000012oypQAA& defaultFieldValues=name='{!Lead.Name}',firstname={!Lead.FirstName},lastname={!Lead.LastName},OwnerId={!Lead.OwnerId}
  • This one opens a "create new" record screen, but it is not prepopulating any of those fields. Plus, with this method I would need to manually go through each field that I want to prepopulate which may be way more busy-work than is really needed if there is a better way to do it.

Thank you

1 Answer 1

2

I tested it in my DevOrg, seems like case -sensitive might be the issue.

Change name to Name ,firstname to FirstName...... Try it

/lightning/o/Lead/new?recordTypeId=0121N0000012oypQAA& defaultFieldValues=Name={!Lead.Name},FirstName={!Lead.FirstName},LastName={!Lead.LastName},OwnerId={!Lead.OwnerId}
5
  • I just tried it with the case-sensitive code but it is still not prepopulating those fields...
    – Mike
    May 27, 2021 at 16:28
  • nevermind when I tried it there was a space between & and defaultFieldValues. When I closed that gap it worked. Thank you very much
    – Mike
    May 27, 2021 at 16:33
  • How would I prepopulate lookup fields? I am trying this: InsuranceCompany__c={!Lead.InsuranceCompany__c} but a strange thing is happening and the insurance company field is vanishing from the new record screen..
    – Mike
    May 27, 2021 at 16:55
  • Hi Rick... I too have faced similar situation with Lookup fields before, seems there is some limitation reference: trailblazer.salesforce.com/ideaView?id=087300000007Pid May 27, 2021 at 17:08
  • Thank you. I just created formula fields that take the id of the lookup fields and prepopulated with those formulas and that seems to do the job.
    – Mike
    May 27, 2021 at 19:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .