How To: Redirect to the Edit Lines Page After Cloning a Quote in CPQ
January 12, 2023

How To: Reference the Newly Cloned Record Id in saveURL2

Use the URL parameter “saveURL2” to redirect to a custom page after the clone operation. The value of this parameter is a URL encoded string. If “[newid]” is included in the value, it will be replaced with the record Id of the newly cloned record Id.

[newid] and saveURL2 Example

The below example will navigate to a custom Visualforce page, and the new record Id will be passed as a URL parameter. The “saveURL2” value is URL encoded except for the constant “[newid]”.

{!URLFOR('/apex/lcrm_scp__scpclone', null, [rid=Opportunity.Id, cfg="opportunityConfig"])}&saveURL2=%2Fapex%2FcustomVfPage%3Fid%3D[newid]
  • The custom button URL above will redirect to the Visualforce page named “customVfPage”. It has a URL parameter named “id”.
  • A constant of “[newid]” is replaced with the new record’s Id. This allows you to redirect to a new page passing the new record’s Id.
  • This string “%2Fapex%2FcustomVfPage%3Fid%3D” is the URL encoded value for “/apex/customVfPage?id=”

The below example redirects to the native Salesforce edit page.

{!URLFOR('/apex/lcrm_scp__scpclone', null, [rid=Opportunity.Id, cfg="opportunityConfig"])}&saveURL2=%2F[newid]%2Fe%3FretURL%3D%2F[newid]
  • This string “%2F[newid]%2Fe%3FretURL%3D%2F[newid]” is the URL encoded value for this “/[newid]/e?retURL=/[newid]”

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
Read more