I have a ligthning component that is clicked when someone is creating new Corset record on the account page which is using force:recordData and also force:recordEditform I am trying to deviate to standard salesfroce create record layout by using force:createRecord if the recordTyeId = '0121l000000266T'. I am new to salesforce lightning. Can somebody help me to achieve this.

<force:recordData aura:id="CorsetData" recordId="{!v.recordId}" fields="{!v.CorsetFields}" targetFields="{!v.CorsetData}"
                  recordUpdated="{!c.onCorsetUpdated}" mode="EDIT"/>
                  <aura:if isTrue="{!lessthanorequal(10,v.accountData.Age__c)}">

                <lightning:recordEditForm aura:id="CorsetEditForm" objectApiName="Corset__c" recordId="{!v.recordId}"
                 <aura:if isTrue="{!v.recordTypeId == '0121l000000266T'}">

                  // Planning to use force:createRecord to deviate to the salesfroce standard record creation page
                  if the recordTypeId = '0121l000000266T'
                  // The plan is to make the page stay on this custom input fields for other record Type Ids

                 // Some input fields to be displayed in the edit form
  • Any leads would be appreciated. May 10 '19 at 11:22
  • can you please answer my questions regarding your issue.1.when aura if is true happened what you want to do? you want create record or not? if not you want display viewform? what you want in else condition?create record? please refere peterknolle.com/lightning-record-edit-form
    – sdandamud1
    May 10 '19 at 11:25
  • Oh, So, when aura if is true then I want to redirect to the creation of standard mask layout if the Corset__c . May 10 '19 at 11:36
  • So, basically, I am trying to find a way to call the createRecord function in the aura if tag. I hope you understand by what I meant May 10 '19 at 11:41
  • any help please !!! May 10 '19 at 12:48

i think in your case you have to use lightning:recordform if i understood correctly. for that you need a value for v.recordTypeId, if you had value for recordtype then us below code and lpost your issue if you get


<lightning:notificationsLibrary aura:id="notifLib"/>    
<force:recordData aura:id="CorsetData" recordId="{!v.recordId}" fields="{!v.CorsetFields}" targetFields="{!v.CorsetData}"
              recordUpdated="{!c.onCorsetUpdated}" mode="EDIT"/>
              <aura:if isTrue="{!and(lessthanorequal(10,v.accountData.Age__c),v.recordTypeId == '0121l000000266T')}">


handllsubmit: function(component, event, helper) {

    var eventFields = event.getParam("fields"); 
// you can customize if you want

handleSuccess: function(component, event, helper) {

                        "variant": "success",
                        "title": "Record Created",
                        "message": "Record ID: " + event.getParam("id")

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.