• Ramkumar Seetharaman
  • NEWBIE
  • 0 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies
I am using standard force:createRecord to create Account. but I dont get create window when I clcik on a button.
I am hosting this lightning app from a VF page (as I want to overide standard button). I have written handler for createRecord event.

But when I host this lightning component from left navigation panel then it works. Please advise what am I missing?.
VF Page :

<apex:page standardController="Account" standardStylesheets="false" showHeader="false" sidebar="false">
    
    <apex:includeLightning />
<apex:includeScript value="/lightning/lightning.out.js" /> 
    <div id="lightning" />

    <script>
        $Lightning.use("c:TestClientCreationApp", function() {
          $Lightning.createComponent("c:TestClientCreation",
          { },
          "lightning",
          function(cmp) {
            // do some stuff
          });
        });
    </script>
</apex:page>

Lightning App : c:TestClientCreationApp

<aura:application access="Global" extends="ltng:outApp" implements="force:appHostable,flexipage:availableForAllPageTypes">
    
    <ltng:require styles="/resource/SLDS201/assets/styles/salesforce-lightning-design-system-ltng.css" />
     <ltng:require styles="/resource/SLDS201/assets/styles/salesforce-lightning-design-system-vf.min.css" />
   
    <aura:dependency resource="c:TestClientCreation"/>
 </aura:application>

Lightning Component : TestClientCreation

<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,force:hasRecordId,force:hasSObjectName" access="global" controller="ThemeCLass">
    
     <aura:handler name="init" value="{!this}" action="{!c.doInit}" />
<aura:dependency resource="markup://force:createRecord" type="EVENT" />
<aura:handler event="force:createRecord" action="{!c.createClient}" />

    
     <ui:button class="slds-button slds-button--brand" aura:id="btnCreateClient" press="{!c.showCreateClientModal}" label="">Create New Client </ui:button> 
</aura:component>

TestClientCreation Js Controller :

showCreateClientModal : function (component, event, helper) {
        
        var createRecordEvent = $A.get("e.force:createRecord");
         createRecordEvent.setParams({
            "entityApiName": "Account"
        });
        createRecordEvent.fire();
        
    },
    
    createClient : function (component, event, helper) {
        
    console.log('Yay');
        
    }

 
I am using standard force:createRecord to create Account. but I dont get create window when I clcik on a button.
I am hosting this lightning app from a VF page (as I want to overide standard button). I have written handler for createRecord event.

But when I host this lightning component from left navigation panel then it works. Please advise what am I missing?.
VF Page :

<apex:page standardController="Account" standardStylesheets="false" showHeader="false" sidebar="false">
    
    <apex:includeLightning />
<apex:includeScript value="/lightning/lightning.out.js" /> 
    <div id="lightning" />

    <script>
        $Lightning.use("c:TestClientCreationApp", function() {
          $Lightning.createComponent("c:TestClientCreation",
          { },
          "lightning",
          function(cmp) {
            // do some stuff
          });
        });
    </script>
</apex:page>

Lightning App : c:TestClientCreationApp

<aura:application access="Global" extends="ltng:outApp" implements="force:appHostable,flexipage:availableForAllPageTypes">
    
    <ltng:require styles="/resource/SLDS201/assets/styles/salesforce-lightning-design-system-ltng.css" />
     <ltng:require styles="/resource/SLDS201/assets/styles/salesforce-lightning-design-system-vf.min.css" />
   
    <aura:dependency resource="c:TestClientCreation"/>
 </aura:application>

Lightning Component : TestClientCreation

<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,force:hasRecordId,force:hasSObjectName" access="global" controller="ThemeCLass">
    
     <aura:handler name="init" value="{!this}" action="{!c.doInit}" />
<aura:dependency resource="markup://force:createRecord" type="EVENT" />
<aura:handler event="force:createRecord" action="{!c.createClient}" />

    
     <ui:button class="slds-button slds-button--brand" aura:id="btnCreateClient" press="{!c.showCreateClientModal}" label="">Create New Client </ui:button> 
</aura:component>

TestClientCreation Js Controller :

showCreateClientModal : function (component, event, helper) {
        
        var createRecordEvent = $A.get("e.force:createRecord");
         createRecordEvent.setParams({
            "entityApiName": "Account"
        });
        createRecordEvent.fire();
        
    },
    
    createClient : function (component, event, helper) {
        
    console.log('Yay');
        
    }

 
I am using standard force:createRecord to create Account. but I dont get create window when I clcik on a button.
I am hosting this lightning app from a VF page (as I want to overide standard button). I have written handler for createRecord event.

But when I host this lightning component from left navigation panel then it works. Please advise what am I missing?.
VF Page :

<apex:page standardController="Account" standardStylesheets="false" showHeader="false" sidebar="false">
    
    <apex:includeLightning />
<apex:includeScript value="/lightning/lightning.out.js" /> 
    <div id="lightning" />

    <script>
        $Lightning.use("c:TestClientCreationApp", function() {
          $Lightning.createComponent("c:TestClientCreation",
          { },
          "lightning",
          function(cmp) {
            // do some stuff
          });
        });
    </script>
</apex:page>

Lightning App : c:TestClientCreationApp

<aura:application access="Global" extends="ltng:outApp" implements="force:appHostable,flexipage:availableForAllPageTypes">
    
    <ltng:require styles="/resource/SLDS201/assets/styles/salesforce-lightning-design-system-ltng.css" />
     <ltng:require styles="/resource/SLDS201/assets/styles/salesforce-lightning-design-system-vf.min.css" />
   
    <aura:dependency resource="c:TestClientCreation"/>
 </aura:application>

Lightning Component : TestClientCreation

<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,force:hasRecordId,force:hasSObjectName" access="global" controller="ThemeCLass">
    
     <aura:handler name="init" value="{!this}" action="{!c.doInit}" />
<aura:dependency resource="markup://force:createRecord" type="EVENT" />
<aura:handler event="force:createRecord" action="{!c.createClient}" />

    
     <ui:button class="slds-button slds-button--brand" aura:id="btnCreateClient" press="{!c.showCreateClientModal}" label="">Create New Client </ui:button> 
</aura:component>

TestClientCreation Js Controller :

showCreateClientModal : function (component, event, helper) {
        
        var createRecordEvent = $A.get("e.force:createRecord");
         createRecordEvent.setParams({
            "entityApiName": "Account"
        });
        createRecordEvent.fire();
        
    },
    
    createClient : function (component, event, helper) {
        
    console.log('Yay');
        
    }