0

Need your help and thank you in advance.

Trying to create a lightning component that would invoke the New Lead Event action. For example from Lightning Experience in Winter 17, when you click the Lead tab, a drop down menu appears with the +New Lead selection, when clicked it will generate the New Lead popup window.

I'm looking for the lightning component syntax that would call the Lead's event handler when the end user presses a button on a lightning component (CREATE).

Is this even possible?

enter image description here

5

Yes it is possible using force:createRecord event handled by one.app container. You will have create a component that has a button.

component.xml

<ui:button press="{!c.createRecord}" label="Create Lead"/>

Controller.js

createRecord : function (component, event, helper) {
    var createRecordEvent = $A.get("e.force:createRecord");
    createRecordEvent.setParams({
        "entityApiName": "Lead"
    });
    createRecordEvent.fire();
}
| improve this answer | |
  • I updated the button component to: <ui:button aura:id="buttonNL" label="NEW LEAD" press="{!c.createRecord}" /> thank you manjit! – rouqeOne Dec 13 '16 at 6:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.