Skip to main content
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
5 件の回答
  1. 2017年1月10日 13:15
    hi ramapoc 

    try to use force:editRecord standard event for Opens the page to edit the record specified by recordId.

    go to below link for it 

    https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/ref_force_editRecord.htm

    i hope it helps you.

    Let me inform if it helps you and kindly mark it best answer if it helps you so it make proper soltuions for others

    thanks 

    http://sfdcmonkey.com  (http://sfdcmonkey.com )
0/9000