5

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.

1 Answer 1

7

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.

3
  • There was a critical update that was auto activated along with summer19. The documentation has been updated to include the namespace requirement. developer.salesforce.com/docs/atlas.en-us.lightning.meta/… May 9, 2019 at 0:30
  • @RickSchmidt thanks, I did see find that in the release notes after I posted this. You reminded me to add that piece in :) May 14, 2019 at 15:51
  • Works great, saved me a lot of time, thanks!
    – UO Man
    Mar 6, 2020 at 13:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .