You need to sign in to do that
Don't have an account?
Stunaite
Overriding New Action just runs first time when called from Related List
TesterContainer.cmp
On contact override New Action with this component
Setup->Object Manager->Contact->Buttons Links and Actions ->New
type
Attention: Skip record type selection page is Checked.
Please run this example on contact related list on account.
Open console on your browser developer tools.
Click on the New button to run the component as below:
You will see on console the result of executing doInit. Console will show:
"Start doInit"
The screen will be blue cos there is no visual components on markup file TesterContainer.cmp.
Now navigate again to account page but DON'T RELOAD the page on browser. Just go back to the previous page, so the account page is shown again.
Press again on New button as before:
You will see on console that doInit() method doesn't run!
Can't find why, cos I was careful to close the component and it should be destroyed as:
https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/ref_jsapi_component_destroy.htm
Please help cos I'm waisting tons of time and I'm with no ideas.
Thanks in Advance!
<aura:component implements="lightning:actionOverride,lightning:hasPageReference"> <!-- Handler of init to execute actions on loading --> <aura:handler name="init" value="this" action="{!c.doInit}"/> <!-- LWC to handle all logic; has to be wrapped on aura component which implements lightning:actionOverride It is commented to simplify the example and avoiding useless noise <c:lWC_NewContactOverriden> --> </aura:component>TesterContainerController.js
({ doInit : function(component, event, helper) { console.log('Start doInit'); $A.get("e.force:closeQuickAction").fire(); } })
On contact override New Action with this component
Setup->Object Manager->Contact->Buttons Links and Actions ->New
type
Attention: Skip record type selection page is Checked.
Please run this example on contact related list on account.
Open console on your browser developer tools.
Click on the New button to run the component as below:
You will see on console the result of executing doInit. Console will show:
"Start doInit"
The screen will be blue cos there is no visual components on markup file TesterContainer.cmp.
Now navigate again to account page but DON'T RELOAD the page on browser. Just go back to the previous page, so the account page is shown again.
Press again on New button as before:
You will see on console that doInit() method doesn't run!
Can't find why, cos I was careful to close the component and it should be destroyed as:
https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/ref_jsapi_component_destroy.htm
Please help cos I'm waisting tons of time and I'm with no ideas.
Thanks in Advance!
https://salesforce.stackexchange.com/questions/220210/init-event-not-always-firing-on-lightning-component-used-as-new-action-overr
All Answers
https://salesforce.stackexchange.com/questions/220210/init-event-not-always-firing-on-lightning-component-used-as-new-action-overr
I've already had tried that and I found that the solution is: