0

I have a lighting page in a lightning community(overriding a record detail page). The lighting page contains a Visualforce Page Component. The visualforce page receives the recordID but I'm also trying to pass an additional URL parameter, but I'm unable to.

Example: https://qa-companyname.cs21.force.com/s/customobj/a4im00000006247AAA?param1=test The visualforce page controller ApexPages.currentPage().getParameters().get('retURL') is coming up blank. Has anyone accomplished something like this before?

6
  • 1
    you cant use that method with embedded vf pages in lighting communities (to my knowledge) - you probably want to cehck Communicating between Lightning Components and Visualforce Pages
    – glls
    Commented Apr 9, 2019 at 20:11
  • @glls well ApexPages.currentPage().getParameters().get('id'); works but the component seems to specifically allow for passing {!recordId}, wasn't sure if there was a way to piggyback off that
    – Phil B
    Commented Apr 9, 2019 at 20:56
  • yes - it does work for ID, but not custom url parameters, and this is only for record pages
    – glls
    Commented Apr 9, 2019 at 21:01
  • I don't know why you marked my question as a duplicate, that question is asking how to get the record ID which I am getting just fine.
    – Phil B
    Commented Apr 9, 2019 at 21:05
  • Oops, i got mixed up with the post - its the other way around - sry
    – glls
    Commented Apr 9, 2019 at 21:08

1 Answer 1

0

For those who are still looking for a way to do this. I have a salesforce Experience site that has a VisualForce page on it. The VisualForce page is dependent on URL parameters. This is how I retrieved the URL parameter for the site.

let url = (window.location != window.parent.location)
            ? document.referrer
            : document.location.href;
console.log({url});
const queryString = url.split('?')[1];
console.log({queryString});
const urlParams = new URLSearchParams(queryString);
console.log({urlParams});
const sfAccountId = urlParams.get("accountId");
console.log({sfAccountId});

You must log in to answer this question.

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