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

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


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. 



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



Rob, You really need to pull this great information into the tutorials / developer doc. I needed this information and start in the doc first.

You are right Irvin.