• ramapoc n
  • NEWBIE
  • 10 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 3
    Replies
Hello All,  
in lightning When i click on custom button it will redirect to standard edit page of the object.   For this, I have created a
1. component which has button
2. Controller.js : which will fire the event

<aura:component controller="AccountLightningSearchclass" implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes" access="global">
  <aura:attribute name="account" type="Account" default="{ 'sobjectType': 'Account'}"/> 
    <aura:registerEvent name="createRecordEvent" type="c:navigateToUrl"/>
    <aura:handler event="c:navigateToUrl" action="{!c.CreateAccount}" />
    <div class="slds-align--absolute-center">
                 <button type="Button" onclick="{!c.CreateAccount}" disabled="false" class="slds-button slds-button--brand">Create Account</button>
             </div>
</aura:component>

2. Controller:
CreateAccount : function(component, event, helper) {

           var createRecordEvent = $A.get("e.force:navigateToRecord");
        alert('Getting Event');
        createRecordEvent.setParams({
            "entityApiName": "Account"
        });
        createRecordEvent.fire();
        }, 
    
})

3. Event:
<aura:event type="APPLICATION" description="Event template" >

 <aura:attribute name="entityApiName" type="String"/>

</aura:event>

But Getting setparams undefined error.
 Thanks in advance
Hello All,  
in lightning When i click on custom button it will redirect to standard edit page of the object.   For this, I have created a
1. component which has button
2. Controller.js : which will fire the event

<aura:component controller="AccountLightningSearchclass" implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes" access="global">
  <aura:attribute name="account" type="Account" default="{ 'sobjectType': 'Account'}"/> 
    <aura:registerEvent name="createRecordEvent" type="c:navigateToUrl"/>
    <aura:handler event="c:navigateToUrl" action="{!c.CreateAccount}" />
    <div class="slds-align--absolute-center">
                 <button type="Button" onclick="{!c.CreateAccount}" disabled="false" class="slds-button slds-button--brand">Create Account</button>
             </div>
</aura:component>

2. Controller:
CreateAccount : function(component, event, helper) {

           var createRecordEvent = $A.get("e.force:navigateToRecord");
        alert('Getting Event');
        createRecordEvent.setParams({
            "entityApiName": "Account"
        });
        createRecordEvent.fire();
        }, 
    
})

3. Event:
<aura:event type="APPLICATION" description="Event template" >

 <aura:attribute name="entityApiName" type="String"/>

</aura:event>

But Getting setparams undefined error.
 Thanks in advance