I am trying to embed a lightning component inside a visualforce page -
MytestVFPage visualforce page-
<apex:outputPanel >
<div id="lightning" />
<script>
$Lightning.use("c:createAccountGlobalApp", function() {
$Lightning.createComponent("c:CreateAccount",
{},
"lightning",
function(component) {});
});
</script>
</apex:outputPanel>
**createAccountGlobalApp** container -
<aura:application access="GLOBAL" extends="ltng:outApp">
<aura:dependency resource="c:CreateAccount"/>
</aura:application>
**createAccount** component -
<aura:component >
<div class = "container">
<ui:button label="Lightning button" press="{!c.createAccountButton}"> </ui:button>
</div>
</aura:component>
createAccountController.js controller
({
createAccountButton : function(component, event, helper) {
helper.createRecord(component);
}
})
createAccountHelper.js helper-
({
createRecord:function(component) {
var createRecordEvent = $A.get("e.force:createRecord");
createRecordEvent.setParams({
"entityApiName": "Account"
});
createRecordEvent.fire();
}
})
When I click on the UI button inside visualforce page it throws an error -
"Something has gone wrong. Action failed: c$CreateAccount$controller$createAccountButton [TypeError: Cannot read property 'setParams' of undefined] Failing descriptor: {c$CreateAccount$controller$createAccountButton}. Please try again. "
Can you please help what is wrong here?