+ Start a Discussion
WarrenWarren 

custom button with retURL

I am trying to make a custom button on a case page layout to have the following functionality:
 
1. open the EmailAuthor page and prepopulate some fields.
2. When the email is sent, I need to use retURL to go back to the case edit page and update the status of the case to "waiting for customer response"
3. I would like to use save=1 to autosave the case and go back to the view case page.
 
This is what I have already:
 
https://na1.salesforce.com/email/author/emailauthor.jsp?p2_lkid={!Case.ContactId}&rtype=003&p3_lkid={!Case.Id}&p26={Email2Case address}}&p6={!Case.Subject}&retURL=%2F{!Case.Id}%2Fe%3Fcas7%3Dwaiting%2520for%2520customer%2520response%26retURL%3D%252F{!Case.Id}
 
cas7 is the case status field on the edit page
 
I cannot get the right combination of URL encoding to get this to work. Has anyone done anything similar to this before?
 
Thanks
Warren
aballardaballard
If you use the UrlFor function to generate the url, and put the query parameters in the parameter map part of that function call, everything should get url encoded correctly.