• Stunaite
  • NEWBIE
  • 10 Points
  • Member since 2021

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies
TesterContainer.cmp
<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

 typeUser-added image

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:

User-added image

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!





 
TesterContainer.cmp
<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

 typeUser-added image

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:

User-added image

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!