0

There is a requirement to show a modal pop-up forcing our user to choose a reason from a dropdown when loading a Case that meets specific requirements.

The following line of code redirects to a specific Case's record page

PageReference casePageRef = new ApexPages.StandardController(currentCase).view();
casePageRef.getParameters().put('callType', lookup.CallType__c);

where a Lightning component exists that takes care of the rest of the work. The last piece that we are stuck on is how to retrieve the callType parameter from that Lightning component.

I can see a redirect happening that has my parameters I'm trying to pick, however the final result of the redirects do not have anything.

The following steps happen:

  1. Go to an initial URL that looks up which Case to load. This is where the PageReference exists.
  2. The browser is redirected a URL that looks something like: https://{org}.lightning.force.com/lightning/_classic/%2F5001f000000uvzp%callType%3DVIVR%26sfdcIFrameOrigin%3Dhttps%253A%252F%{org}.lightning.force.com%26clc%3D1
  3. The browser is redirected to a final URL that looks like: https://{org}.lightning.force.com/lightning/r/Case/5001f000000uvzpAAA/view

Now the application is loading the actual record page. My component loads. There are no parameters any more.

1

Component has a method get in which you can pass the attribute value as v.pageReference to get the page parameter. Refer the release notes of Summer 18. You can use below code:

var urlParameter = component.get("v.pageReference").state.callType;

Make sure that you're implementing lightning:isUrlAddressable interface.

| improve this answer | |
  • I added additional detail to the question as this solution did not solve my issue. – user2120800 Jan 16 at 17:31
0

Edit:

The trouble is that you are returning a visualforce page reference which is redirecting to lightning experience page. Construct the final lightning experience page reference explicitly -

PageReference casePageRef = 
new PageReference('https://{org}.lightning.force.com/lightning/r/Case/' 
+ Id + '/view?c__callType=' + lookup.callType__c );

Also, note change to query string parameters. They get stripped out unless you start them with 'c__' (see - How to pass query parameters in URL in Salesforce Summer 19 Release?)

=====

You can retrieve query string parameter using javascript:

let url = new URL(document.URL);
let conferenceId = url.searchParams.get("callType");

Perhaps put this code in the init for the component?

| improve this answer | |
  • I added additional detail to the question as this solution did not solve my issue. – user2120800 Jan 16 at 17:32
  • Updated answer. – eaeaoo Jan 17 at 8:34

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.