I'm trying to overrides the standard 'New' action on one of my custom object.

enter image description here

First of all, as you can see from the above picture, the 'Skip Record Type Selection Page' checkbox doesn't seem to work. When I uncheck this checkbox, I still have a visualforce page asking to select a record type. The weirder part is that the standard Lightning record type selection is replaced by a Visualforce page. See the below picture.

enter image description here

On the other hand, it's impossible to get the record type which was selected previously. Whereas the selected record type id appears on the url like this: https://lgc-bfl--dev2.lightning.force.com/one/one.app#/sObject/LGC_Ligne_bordereau__c/new?recordTypeId=0129E00000008zP.

I tried to declare it as attribute:

<aura:attribute name="recordTypeId" type="String" />

Then access it from my controller:


But the attribute is undefined.

How am I supposed to know which record type was selected? If this is not possible, why can't I remove the record type selection and handle it myself?

  • 2
    Cannot answer as to the VF RT Selection appearing. Sounds like a undesired behaviour to me. Instead of v.recordTypeId try to use var currentUrl = window.location; and see if you can extract recordId from there Jul 24, 2017 at 9:23
  • Thanks @ChristianSzandorKnapp. I'll use this as my last resort. Jul 24, 2017 at 9:26
  • @MartinLezer I just tested in my sandbox - I get the exact same behavior. The record type selection page is in VF format, and displays with or without the checkbox Skip Record Type Selection Page. regarding the recordTypeId attribute - why do you think this would be populated? I cannot find any documentation about that Jul 25, 2017 at 7:14
  • @ItaiShmida I don't think it would be populated. But if Salesforce force me to use this VF page, there should be a way to get the recordTypeId. If not, this is impossible to override the new standard action with a Lightning component. Jul 25, 2017 at 7:18
  • 3
    I agree - this looks like a bug to me Jul 25, 2017 at 7:19

4 Answers 4


I was facing similar issue then as a workaround I am using javascript to fetch the Id and then passing in my controller.

var url_string = window.location.href;
console.log(url_string.substring(url_string.indexOf("recordTypeId") + 13,url_string.indexOf("recordTypeId") + 28));

This still doesn't work for one of the New button overrides on Standard object. for e.g. it works fine for Account (i.e. record type page is skipped), when new button is overridden with a lightning component. But, the issue persists and the record type selection page is not skipped, when new contact button is overridden with another lightning component.

Known issue: https://success.salesforce.com/issues_view?id=a1p3A0000018AqwQAE


Ok guys, I just tested it on Salesforce Winter 18' and it was corrected !

  • winter 18?, really?
    – Cloxure
    Sep 5, 2017 at 15:05
  • @Cloxure Yes I checked and it worked ! Sep 5, 2017 at 15:06
  • I am on winter 17, and I cannot change to winter 18.....
    – Cloxure
    Sep 5, 2017 at 15:08
  • 1
    @Cloxure There are only developer previews available. Sandbox preview is scheduled to begin September 8, 2017. Sep 5, 2017 at 15:11
  • thanks @Martin Lezer, I am looking at the changes now, is amazing.
    – Cloxure
    Sep 13, 2017 at 17:38

There is a better way to get the recordTypeId now. Please checkout my answer in this post

You must log in to answer this question.

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