Super Clone
Edit Page and Custom Button Settings
The Edit page can be used to update fields on the primary object and selected related list records at the same time. The configuration for the edit page is similar to that of the clone page. However, configuration field settings for Action and Value are ignored in the edit page because the existing record’s values are shown in the fields.
Edit Page Example
- Many records can be edited at the same time
- Multiple related lists can be presented on the same page.
- Press Save to save changes, and return to the original record.
- Press Cancel to return to the original record.
Custom Button Setup
Navigate to the primary object’s area for Buttons, Links, and Actions.
- Create a new Custom Button for the object.
- Enter a Label, Name, and Description.
- Select Detail Page Button for the button to be available at the top of a page layout, or select List Button for the button to be available on a related list.
- Select the behavior for the window after the button is pressed. Display in existing window with sidebar will result in an experience most users would expect.
- Select URL for the Content Source.
- Enter the path to the edit page with URL parameters for the record id and a reference to the configuration name.
The example custom button shown below references the “supercloneedit” page. Notice that “edit” is appended to “superclone”.
URL Example Explained
/apex/dh_superclone__supercloneedit?rid={!Account.Id}&cfg=AcctEdit
- “/apex/dh_superclone__supercloneedit” This is a reference to the Visualforce page. The namespace prefix is “dh_superclone”. It is separated from the page name, “supercloneedit”, by two underscores.
- “?” indicates the start of URL parameters
- “rid={!Account.Id}” tells the edit page which record should be edited. “rid” is a URL parameter, and “{!Account.Id}” is the parameters value that represents the record’s identifier. Change “Account.Id” to reference the primary object that is being edited.
- “&” separates URL parameters
- “cfg=AcctEdit” is the parameter that references the name of the configuration. Change “AcctEdit” to the name your configuration.
Additional URL Parameters
- Use the URL parameter ‘saveURL2’ to redirect the page after the edit operation. This takes a URL encoded string as the parameter’s value.
- Use the URL parameter ‘retURL2’ to redirect the page when the Cancel button is clicked. This takes a URL encoded string as the parameter’s value.
- A constant of ‘[newid]’ is replaced with the new record’s Id in the ‘saveURL2’ parameter. This allows you to redirect to a new page passing the new record’s Id.
/apex/dh_superclone__supercloneedit?rid={!Opportunity.Id}&cfg=MyConfig&saveURL2=006&retURL=%2F{!Opportunity.Id}
- The custom button URL above will redirect you to the Opportunity tab after the edit completes successfully.
/apex/dh_superclone__supercloneedit?rid={!Opportunity.Id}&cfg=MyConfig&saveURL2=%5Bnewid%5D%2Fe%3FretURL%3D%2F%5Bnewid%5D
- The custom button URL above will redirect you to the standard Opportunity edit page after the edit completes successfully.
- This string ‘%5Bnewid%5D%2Fe%3FretURL%3D%2F%5Bnewid%5D’ is the URL encoded value for this ‘[newid]/e?retURL=/[newid]’, which is what shows in the location bar when editing a record.