You need to sign in to do that
Don't have an account?
Ujwala
I am facing a issue all of sudden. I have two object Lead and Estimate. Estimate comes in related list of Lead. From Lead i can create new estimate. I created a LWC component which is used to create new Estimate records. LWC component i have embedded in aura component. I developed related LWC 3 months back, on click of new button aura component is getting loaded first which loads LWC. In Aura controller i have tried to fetch recordId(lead Id) which was appearing in url using below code
var pageRef = component.get("v.pageReference"); console.log(' PageREf'+JSON.stringify(pageRef)); var state = pageRef.state; // state holds any query params console.log('state = '+JSON.stringify(state)); var base64Context = state.inContextOfRef; console.log('base64Context = '+base64Context); if (base64Context.startsWith("1\.")) { base64Context = base64Context.substring(2); console.log('base64Context = '+base64Context); } var addressableContext = JSON.parse(window.atob(base64Context)); console.log('addressableContext = '+JSON.stringify(addressableContext)); component.set("v.recordId", addressableContext.attributes.recordId);
This code was giving me LeadId from url. But from 3/4 days i am getting error when aura component is loaded. I tried to debug issue i observed change in URL. Previously a different URL was opening on click of new button which was holding lead id but now a days a different URL is appearing hence aura is not able to get leadId from url. I dont have exact URL but it was roughly like https://.../lightning/o/VLSF_Estimate__c/new?inContextOfRef=1.eyJ0eXBlIjoic3RhbmRhcmRfX29iamVjdFBhZ2UiLCJhdHRyaWJ1dGVzIjp7Im9iamVjdEFwaU5hbWUiOiJWTFNGX0VzdGltYXRlX19jIiwiYWN0aW9uTmFtZSI6Imxpc3QifSwic3RhdGUiOnsiZmlsdGVyTmFtZSI6IlJlY2VudCJ9fQ%3D%3D&count=1%2FLead%2F00Q1g000005oxHBEAY%2Fview
But now when i click new url i am getting is https://.../lightning/o/VLSF_Estimate__c/new?count=1 Please help me to understand what can be the reason behind change in onload URl..
Sudden change in the url on click of new button click
I am facing a issue all of sudden. I have two object Lead and Estimate. Estimate comes in related list of Lead. From Lead i can create new estimate. I created a LWC component which is used to create new Estimate records. LWC component i have embedded in aura component. I developed related LWC 3 months back, on click of new button aura component is getting loaded first which loads LWC. In Aura controller i have tried to fetch recordId(lead Id) which was appearing in url using below code
var pageRef = component.get("v.pageReference"); console.log(' PageREf'+JSON.stringify(pageRef)); var state = pageRef.state; // state holds any query params console.log('state = '+JSON.stringify(state)); var base64Context = state.inContextOfRef; console.log('base64Context = '+base64Context); if (base64Context.startsWith("1\.")) { base64Context = base64Context.substring(2); console.log('base64Context = '+base64Context); } var addressableContext = JSON.parse(window.atob(base64Context)); console.log('addressableContext = '+JSON.stringify(addressableContext)); component.set("v.recordId", addressableContext.attributes.recordId);
This code was giving me LeadId from url. But from 3/4 days i am getting error when aura component is loaded. I tried to debug issue i observed change in URL. Previously a different URL was opening on click of new button which was holding lead id but now a days a different URL is appearing hence aura is not able to get leadId from url. I dont have exact URL but it was roughly like https://.../lightning/o/VLSF_Estimate__c/new?inContextOfRef=1.eyJ0eXBlIjoic3RhbmRhcmRfX29iamVjdFBhZ2UiLCJhdHRyaWJ1dGVzIjp7Im9iamVjdEFwaU5hbWUiOiJWTFNGX0VzdGltYXRlX19jIiwiYWN0aW9uTmFtZSI6Imxpc3QifSwic3RhdGUiOnsiZmlsdGVyTmFtZSI6IlJlY2VudCJ9fQ%3D%3D&count=1%2FLead%2F00Q1g000005oxHBEAY%2Fview
But now when i click new url i am getting is https://.../lightning/o/VLSF_Estimate__c/new?count=1 Please help me to understand what can be the reason behind change in onload URl..
Thanks for the acknowledgement.
I guess you could have observed this issue after Summer 21 preview release and since all of sudden you see this issue.
I would encourage you to confirm the behavior in Orgs which are still in Spring 21 release version compared to Summer 21 preview release orgs and if you find any discrepencies in the behavior from the platform end with same code, then raise a case with Salesforce support and after further debugging with the code, the product teams should be able to give you more insights on this.
Hope above information helps, Please mark as Best Answer so that it can help others in the future.
Thanks.
All Answers
Can you please confirm if you are using lightning:isUrlAddressable interface in your lightning component?
The lightning:isUrlAddressable interface extends the lightning:hasPageReference interface. A component that implements lightning:isUrlAddressable then gets access to the page state through the pageReference attribute. The page state is a representation of the current URL query parameters.
lightning:isUrlAddressable enables you to generate a user-friendly URL for a Lightning component with the pattern /cmp/componentName instead of the base-64 encoded URL you get with the deprecated force:navigateToComponent event.
Usage reference:
https://developer.salesforce.com/docs/component-library/bundle/lightning:isUrlAddressable/documentation
Thanks.
Yes I have included interface as below
<aura:component implements="lightning:isUrlAddressable,flexipage:availableForRecordHome,force:hasRecordId,lightning:actionOverride,force:lightningQuickAction,force:hasSObjectName" access="global" >
Thanks for the acknowledgement.
I guess you could have observed this issue after Summer 21 preview release and since all of sudden you see this issue.
I would encourage you to confirm the behavior in Orgs which are still in Spring 21 release version compared to Summer 21 preview release orgs and if you find any discrepencies in the behavior from the platform end with same code, then raise a case with Salesforce support and after further debugging with the code, the product teams should be able to give you more insights on this.
Hope above information helps, Please mark as Best Answer so that it can help others in the future.
Thanks.