I am in lightning experience using a custom component in a custom tab. Previously force:createRecord worked just fine when this button was clicked. I changed the code to force:editRecord and now nothing happens when this button is clicked.

createQuestion : function(component, event, helper) {
    var editRecord = $A.get("e.force:editRecord");

        "recordID": component.get("v.currentQuestion.Id")


<aura:component implements="flexipage:availableForAllPageTypes" controller="QuestionViewerController" >

<aura:handler name="init" value="{!this}" action="{! c.doInit }"/>
<aura:handler name="QuestionAddedEvent" action="{! c.reloadQuestions }" event="c:QuestionAddedEvent"/>

<aura:attribute name="title" type="String" required="true" default="Question Viewer"/>
<aura:attribute name="Questions" type="Question__c[]"/>
<aura:attribute name="currentQuestion" type="Question__c"/>
<aura:attribute name="index" type="Integer" />
<aura:attribute name="bodyEmpty" type="Boolean"/>

<lightning:card title="{!'Question: ' + v.currentQuestion.Name}" class="slds-p-horizontal_medium">
    <div class="slds-grid--verticle">
        <div class="slds-col slds-no-flex">

            <aura:if isTrue="{! v.bodyEmpty }">
                    <lightning:formattedText class="slds-text-heading_medium slds-no-flex" title="{!v.currentQuestion.Name}" value="{!v.currentQuestion.Explanation__c}"/>
                <aura:set attribute="else">
                    <lightning:formattedText class="slds-text-heading_medium slds-no-flex" title="{!v.currentQuestion.Name}" value="{!v.currentQuestion.body__c}"/>    

        <div class="slds-p-top_medium slds-p-bottom_medium">
            <lightning:formattedText aura:id="answer" class="slds-text-heading_small slds-no-flex slds-hide slds-box" value="{! v.currentQuestion.answer__c }"/>
        <div class="slds-col slds-no-flex slds-theme_info">
            <button class="slds-button" onclick="">
                <lightning:icon iconName="action:back" size="small" alternativeText="Do something" />

            <button class="slds-button" onclick="">
                <lightning:icon iconName="action:delete" size="small" alternativeText="Do something" />

            <button class="slds-button" onclick="{! c.createQuestion }">
                <lightning:icon iconName="action:flow" size="small" alternativeText="Do something" />

            <button class="slds-button" onclick="{! c.showAnswer }">
                <lightning:icon iconName="action:new_campaign" size="small" alternativeText="Do something" />

            <button class="slds-button" onclick="{! c.nextQuestion }">
                <lightning:icon iconName="action:refresh" size="small" alternativeText="Do something" />

            <lightning:formattedText class="slds-p-horizontal_small" value="{! v.currentQuestion.Category__c }" />

  • 1
    have you tried changing recordID to recordId? – glls Jan 2 '18 at 15:48

Attribute Parameters are case sensitive, when you are setting the recordId, makse sure the casing is correct:


is invalid, as far as I am concerned, this will throw an error (if you are capturing it, however, by the looks of your code, you aren't.)

the correct syntax is:


I encourage you to add exception handling and capture error messages to debug your code.

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.