Home SALESFORCE Differentiate saveURL, cancelURL, retURL in Salesforce URL Parameters

Differentiate saveURL, cancelURL, retURL in Salesforce URL Parameters

There are many URL parameters used by Salesforce.com, but saveURL, cancelURL and retURL are the very most fundamental and regularly used in salesforce.

For Example
https://cs8.salesforce.com/001L000000iNUCrIAO/e?retURL=%2F001L000000iNUCrIAO

Let’s break the URL from above:

https://cs8.salesforce.com/ — the salesforce domain
001L000000iNUCrIAO — the account record id
/e — the action for the record, e stands for edit in this case from salesforce
? … — everything after the ? is the query string, which begins with a ? and is & delimited with key = value pairs, e.g. ?a=b&c=d&e=f, we have 3 variables being set: a which is set to b, c which is set to d and e which is set to f
so here a is a key and b is a value.

retURL=%2F001L000000iNUCrIAO – the URL you want to redirect the user to when he clicks CANCEL Button. %2F denotes a ‘/’ and the merge field {!Account.Id} gives the Account to redirect to after clicked the Cancel Button

saveURL – similar to retURL except that it defines the URL to redirect to after the user clicks ‘SAVE Button’.

Save button is as follows:

  • Is there a saveURL URL parameter set? If so, redirect to that.
  • Is there a retURL URL parameter set? If so, redirect to that.
  • Redirect to /home/home.jsp

Note: The behavior is slightly different if we’re creating a new record.

Cancel button is as follows:

  • Is there a cancelURL URL parameter set? If so, redirect to that.
  • Is there a retURL URL parameter set? If so, redirect to that.
  • Redirect to /home/home.jsp

When saving a new record, you can use the saveURL parameter:
{!URLFOR($Action.Contact.NewContact, c.id, [‘saveURL’=’/home/home.jsp’])}

When editing an existing record, you can use the retURL parameter:
{!URLFOR($Action.Event.Edit, c.id, [‘retURL’=’/home/home.jsp’])}

You may also like

Leave a Comment