Getting RecordTypeId selected from 'Record Type Selection' Page, in a lightning component that overrides create screen
Summer'18 update provided a new interface 'lightning:hasPageReference'. You can now access the recordTypeId in your controller as below:
var recordTypeId = component.get("v.pageReference").state.recordTypeId;
https://developer.salesforce.com/docs/component-library/bundle/lightning:hasPageReference/documentation
Try using force:createRecord
which has a recordTypeId
attribute.
var createAcountContactEvent = $A.get("e.force:createRecord");
createAcountContactEvent.setParams({
"entityApiName": "Contact",
"defaultFieldValues": {
'Phone' : '415-240-6590',
'AccountId' : '001xxxxxxxxxxxxxxx',
'recordTypeId': "1234455566"
}
});
createAcountContactEvent.fire();