Skip to main content
1 of 2
sfdc_to_learn
  • 1.8k
  • 2
  • 39
  • 91

navigating from aura to lwc component with background context

I have overriden Opportunity new button with Aura component below. Then I am trying to navigate from aura to LWC with a backgroundContext which means i want to open the lwc just in front of list view . But currently the page is opening with a blank background,

enter image description here

I m trying to open it on top of list view

 <aura:component implements="lightning:actionOverride,lightning:isUrlAddressable" access="global" >
    
    
         <aura:handler name="init" value="{! this }" action="{! c.myAction }"/>
          <lightning:navigation aura:id="navService"/>
    </aura:component>

JS

({
    myAction : function(component, event, helper) {
        var navService = component.find("navService");
        var compDefinition = {
            type: 'standard__component',
            componentDef: "c:newoppwizard",
            attributes: {
            },
            state: {
                nooverride: 1,
                navigationLocation: 'LIST_VIEW',
                backgroundContext: '/lightning/o/Opportunity/list?filterName=Recent'
                //backgroundContext: back_url
            }
        };
        let encodedCompDef = btoa(JSON.stringify(compDefinition));
        var urlEvent = $A.get("e.force:navigateToURL");
        urlEvent.setParams({
            "url": "/one/one.app#" + encodedCompDef
        });
        urlEvent.fire();
    }
})
sfdc_to_learn
  • 1.8k
  • 2
  • 39
  • 91