Skip to main content
Hi All,

I am trying to call a lightning component from flow, and facing an error

This page has an error. You might just need to refresh it. Action failed: c:CreateNewOpportunity$controller$doinit [Cannot read properties of null (reading 'state')] Failing descriptor: {c:CreateNewOpportunity$controller$doinit}

Component:

<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,lightning:availableForFlowScreens,lightning:actionOverride,lightning:isUrlAddressable" access="global"  controller="OpportunityController">

    

   <aura:attribute name="accOppList" type="list" />

    <aura:attribute name="userList" type="list" /> 

    <aura:attribute name="url" type="String" />

      

     <aura:handler name="init" value="{! this }" action="{! c.doinit }" />  

    <aura:handler name="change" value="{!v.pageReference}" action="{!c.doinit}" />

   

    <lightning:navigation aura:id="navigate" />

    <lightning:button label="Navigate" onclick="{!c.handleClick}"/>

</aura:component>

({

    doinit : function(component, event, helper) {

        helper.getUserDetails(component, event, helper);

       

        var pageRef = component.get("v.pageReference");

        var state = pageRef.state; // state holds any query params

        var base64Context = state.inContextOfRef;

        if (base64Context.startsWith("1\.")) {

            base64Context = base64Context.substring(2);

        }

        var addressableContext = JSON.parse(window.atob(base64Context));

        component.set("v.recordId", addressableContext.attributes.recordId);

        

        helper.getOpportunityDetails(component, event, helper);       

    }

})

Cannot read properties of null (reading 'state')] Failing descriptor

this is the error. why is this coming?
3 件の回答
0/9000