Global Action and Save/Cancel button Redirect back to Skuid page with Params

  • 1
  • Question
  • Updated 4 years ago
  • Answered
I have the following URL:
https://skuid.cs18.visual.force.com/apex/skuid__ui?CaseId=50011000003AQptAAG&page=CaseDetailsModel

I am using a Global Action and creating an Attach a File to the Case. This is a redirect action

with regards to the retURL I have tried the following:
/p/attach/NoteAttach?pid={{$Param.CaseId}}&retURL=%2F/apex/skuid__ui?CaseId={{$Param.CaseId}}/page=CaseDetailsModel
AND
/p/attach/NoteAttach?pid={{$Param.CaseId}}&retURL=%2F/apex/skuid__ui?CaseId={{$Param.CaseId}}&page=CaseDetailsModel


As I want the return url to be: /apex/skuid__ui?CaseId=50011000003AQptAAG&page=CaseDetailsModel

It works fine to have the return URL to contain CaseId={{$Param.CaseId}} OR page=CaseDetailsModel but I don't know how to include both in the return URL.

I want to return the URL and have the correct page showing, would you know how to do this.

Also for the Save and Cancel buttons on standard pages.

i.e. If the user wishes to edit a case, then I have the skuid page redirect to the standard edit case page. Is there a way to redirect back to the original skuid page, after they click Save or Cancel on the standard salesforce page, thanks
Photo of Eddie

Eddie

  • 720 Points 500 badge 2x thumb

Posted 4 years ago

  • 1
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
One problem I see is that the retURL needs to be URL encoded so that when it is passed in the URL it is interpreted correctly.  There cannot be characters like "/" or "?" in the retURL value - because those will get interpreted by the browser as part of the base URL rather than as part of the retURL parameter. 

A more appropriate URL encoding for the returl would be somthing like this. 

%2Fapex%2Fskuid__ui%3FCaseId%3D{{$Param.CaseId}}%2Fpage%3DCaseDetailsModel

I know that looks like ugly code that would be impossible to remember.  We use a cheater URL encoder tool  (like this:  http://meyerweb.com/eric/tools/dencoder/) when building pages.  

In addition the merge fields  - {{$Param.CaseId}}  shouldn't be URL encoded because they get replaced with real values before being sent to the browser.  If you did URL encode them the merge wouldn't work...

Hope that helps. 
Photo of Irvin Waldman

Irvin Waldman, Champion

  • 9,006 Points 5k badge 2x thumb
Rob, You really need to pull this great information into the tutorials / developer doc. I needed this information and start in the doc first.
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
You are right Irvin. 
Photo of Eddie

Eddie

  • 720 Points 500 badge 2x thumb
Thanks Rob I have built this for the URL:
/p/attach/NoteAttach?pid={{$Param.CaseId}}&retURL=%2Fapex%2Fskuid__ui%3FCaseId%3D{{$Param.CaseId}}%2Fpage%3DCaseDetailsModel

It goes to the attach file Salesforce page and then redirects me to this URL:
https://skuid.cs18.visual.force.com/apex/ui?CaseId=50011000003AQptAAG%2Fpage%3DCaseDetailsModel

and I get this error:
You've been INKED! (Something went wrong)
Skuid was unable to redirect the user to standard Salesforce Page Layouts, and no Skuid Page could be used instead.

as the page=CaseDetailsModel prob isn't correct, can you suggest anything.

Thanks

Edward