0

I'm trying to make a simple component for my home page which creates a record with a specific record type. Every time I try it, it uses the default record type instead of the intended. I've made a lot of components before with this function but never specified recordTypId. I've read the documentation and I'm at a bit of a loss as to why its not working with me.

Component:

<aura:component implements="flexipage:availableForAllPageTypes" access="global">
    <lightning:card title="QUICK LINKS">
        <div class="slds-p-around_medium slds-grid">
            <div class="slds-col"> 
              <div onclick="{!c.redirectToNewItTicket}">
                  <img src="{!$Resource.quickItTicket}"/> 
              </div>
            </div>
        </div>
   </lightning:card>
</aura:component>

Controller:

({
    redirectToNewItTicket : function(component, event, helper) {
        console.log('redirectToNewItTicket start');
        var createRecordEventItTicket = $A.get("e.force:createRecord");
        createRecordEventItTicket.setParams({
            "entityApiName": "Help_Desk__c",
            "recordTypeId " : "012o00000003hMC"
        }); 
        createRecordEventItTicket.fire();
        console.log('redirectToNewItTicket end');
    }
})

I have verified the RecordType Id is correct. I used this code to ensure it is:

Schema.SObjectType.Help_Desk__c.getRecordTypeInfosByName().get('IT').getRecordTypeId();

Any ideas? I'm thinking I'm missing something basic here.

0

You appear to have an extra space in the recordTypeId attribute so that it is "recordTypeId " and not "recordTypeId". That's why it's not recognizing it as a valid parameter.

  • ah frick. Didn't even notice that. Thank you! It works! – Alex Miller Jul 18 at 14:25

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.