I have an apex page where I display a table with some information retrieved from an API, now I want to send information from the table when an user clicks a row from it, redirect to another apex page, with its own controller, using Javascript Remoting and display the info from the previous page in the new one.

Is this possible to accomplish using Javascript Remoting? If it is, How can I accomplish it?

Thanks in advance

  • 1
    Sounds like a perfect job for Platform Cache rather than JS remoting. – dzh Jul 5 '18 at 9:17

if you are looking to change pages here - would be better to add it to page parameters of the next page and then redirect to the new page - adding the previous page as your return url.

To me, it doesn't make much since to do this in VF remoting - but using an actionFunction will be enough to set the parameter and return the PageReference of the new page with the added parameters.

However - that being said - you can have a VF function return the URL and redirect in JS once you have received your valid promise. But again, this does not seem like you're making good use of the capabilities of the platform by doing it this way. So to answer your question - YES - it is possible, however not really logical when you can use the platform better to accomplish this with actionFunction

Action Function Docs

  • This sounds like a good alternative to what I'm trying to do, but is there a way to avoid the parameters passing in the URL? I want to handle clear urls without displaying the data passed to other pages. – Manu Jul 5 '18 at 14:45
  • how about masking the URL Param values? – Ronnie Jul 5 '18 at 21:36
  • I've trying your solution but the pageReference doesn't work properly with actionFunction :( – Manu Jul 6 '18 at 18:57
  • ok - i will add a separate answer with an updated solution. There is always more than one way to do anything. – Ronnie Jul 7 '18 at 1:10
  • but first - is this API some external system? or is it an API fetching data from an SObject in SF? – Ronnie Jul 7 '18 at 1:12

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.