Not able to set Record Type on Custom Button

custom-buttonrecord-type

I have created a custom button that will load a page to create an opportunity in which few fields needs to be prefilled and it should have a specific RecordType. But the issue is all the fields are getting populated but the record is created with the default Record Type and not the RecordType mentioned. This is the code I am using

/lightning/o/Opportunity/new?defaultFieldValues=RecordType=0121U000000KDRIQA4,AccountId={!Task.What},Campaign_Member__c={!Task.Campaign_Member__c},CampaignId={!Task.CampaignId__c},ContactId={!Task.Who}

I have also tried the below code but nothing seemed to work. It is using the default record type.

/lightning/o/Opportunity/new?RecordType=0121U000000KDRIQA4&defaultFieldValues=AccountId={!Task.What},Campaign_Member__c={!Task.Campaign_Member__c},CampaignId={!Task.CampaignId__c},ContactId={!Task.Who}

Can anybody please help me on this.

Best Answer

Here recordTypeId is case sensitive and make sure you use 'recordTypeId' to set default record type value.

/lightning/o/Opportunity/new?recordTypeId=0121U000000KDRIQA4&defaultFieldValues=AccountId={!Task.What},Campaign_Member__c={!Task.Campaign_Member__c},CampaignId={!Task.CampaignId__c},ContactId={!Task.Who}
Related Topic