function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
alsinan nazimalsinan nazim 

Force:createRecord hitting error when fired from helper

Hello Everyone

I got an issue when firing the below event from Helper, and is working fine in controller in Lightning Component. Any hints?
var createRecordEvent = $A.get("e.force:createRecord");
createRecordEvent.setParams({
            "entityApiName": "Account" // using account standard object for this sample
        });
 createRecordEvent.fire();

 
Priyananth RPriyananth R
Hi 
I don't know exactly what you have done.
I will share sample code, Just try it.

CreateAccount.cmp :
<aura:component implements="flexipage:availableForAllPageTypes">
    <lightning:button label="Create Account" variant="brand" onclick="{!c.createAccount}"/>
</aura:component>
CreateAccountController.js
({
	createAccount : function(component, event, helper) {
        helper.helperCreateAcc();
	}
})
CreateAccountHelper.js
({
    helperCreateAcc : function() {
        var createRecordEvent = $A.get("e.force:createRecord");
        createRecordEvent.setParams({
            "entityApiName": "Account" 
        });
        createRecordEvent.fire();
    }
})

 
Raj VakatiRaj Vakati
force:createRecord will work only from the lighting experience .. 

If you use the force:createRecoad in .  app ( standalone ) it wnt work ..