How to pass query parameters in URL in Salesforce Summer 19 Release?

The requirement was to open a Lightning App page and pass some query parameters in the URL. These query parameters were then used to query data and display in a Lightning component present in the Lightning App.

Till Spring 19, it was working fine. This was the URL format:

force.com/lightning/n/Document_Upload?id=0015B00000fS9mzQAC&type=AccountDocument

where Document_Upload was the name of the Lightning App and ‘id’ and ‘type’ were the query parameters.

In Summer 19, the same URL format doesn’t work.

In fact, any query parameter appended to a page is removed as the page loads.

So, this URL,

force.com/lightning/n/Document_Upload?id=0015B00000fS9mzQAC&type=AccountDocument

becomes

force.com/lightning/n/Document_Upload

How do I pass query parameters here?

Answer

I think there is a Critical Update that gets auto-enabled for Summer ’19, that forces Lightning URL parameters to be namespaced. And the default namespace for orgs is “c”.

So if you add ?foo=bar to the URL, it will get auto-stripped.

But if you add ?c__foo=bar to the URL, it will persist.

Attribution
Source : Link , Question Author : Prakhar Saxena , Answer Author : Charles T

Leave a Comment