2

Ran into an issue after the Summer 19 preview in my sandbox. I have a Visualforce page re-directing to a lightning URL Accessible component passing in a parameter, here is the controller code:

PageReference pr = new PageReference('/lightning/cmp/c__SomeComponent?someParam='+this.someParam);

Everything is working fine in production; however, in the Sandbox the PageReference state no longer registers the parameter when the lightning page initializes.

When I do a debug, I see that the parameter is being passed from my VF controller as a part of the URL; however, when the page loads the parameter is no longer listed in the URL. Additionally, I checked what was actually being processed in the state:

console.log(Object.getOwnPropertyNames(component.get('v.pageReference').state));

It did not contain the attribute I was passing.

Color me confused.

3

After some teeth gnashing and head banging, I found this.

I saw that they were including c__ in the parameter's, so I decided that it couldn't hurt to give it a whirl. Lo and behold the parameter passed without issue.

Any parameter I attempted to pass in was being eliminated without including adding c__ to its name.

So long story short, if you parameters are disappearing when calling a URL Accessible Lightning component, add c__ to the front of the parameter name, then adjust your controller to retrieve the parameter with c__ and you should be in business.

//Apex Controller
//before
PageReference pr = new PageReference('/lightning/cmp/c__SomeComponent?someParam='+this.someParam);
//after
PageReference pr = new PageReference('/lightning/cmp/c__SomeComponent?c__someParam='+this.someParam);
//Component Controller
//before
component.get('v.pageReference').state.someParam
//after
component.get('v.pageReference').state.c__someParam

Once you make those quick adjustments, you'll be in business again. This is the first time an SFDC upgrade has broken my code in a long time, so hopefully this will help save folks from much teeth gnashing and headbanging.

Update, a critical update applied the Summer 19 upgrade caused the issue.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.