8.2.2 Use Cases for the Generic Clone Feature
Create new Proposals Versions/Alternative Offers
Here we show you one example how to set up and use the Generic Clone Feature to copy Media Campaign records and its child records.
Business Case: In order to offer several options of a Media Campaign proposal to your customer, you can clone an existing Media Campaign including all its relevant information. Moreover, a link back to the original Media Campaign can also be defined in order to compare all versions of a Media Campaign. Here is how you do it:
Parent Media Campaign - Manual vs. Automated Process
You can choose from those two options:
Media Campaign - Option 1 - Create Lookup Manual Process
Create a lookup field on Media Campaign object to build a Parent Media Campaign relation.
Create a new custom field:
- Navigate to Setup > Object Manager > Media Campaign > Fields & Relationships.
- Click the button New.
- Select Lookup Relationship as Data Type.
- Click the button Next.
- Select Media Campaign at the field Related To.
- Click the button Next.
- Enter the following information:
- Field Label: Parent Media Campaign
- Field Name: ParentMediaCampaign
- Description: This field relates to the Master Media Campaign.
- Help Text: Please enter the Parent Media Campaign.
- Child Relationship Name: MediaCampaigns
- Click the button Next.
- Select the Field-Level Security for Profiles (Visible = True).
- Click the button Next and select the Page Layouts that should include this related list.
- Click the button Save.
You have successfully created a Parent Media Campaign Lookup.
Media Campaign - Option 2 - Automated Process
While creating a new Media Campaign, the user now can manually enter the current Media Campaign to this lookup called Parent Media Campaign. To automatically set this hierarchy, the system administrator can create an auxiliary field and a custom link to the Media Campaign. A text field at Media Campaign level should be created to create a Parent Media Campaign relation. This field is then filled by a workflow with the record id of the Media Campaign. Any button, link or formula is able to grab the value of this field and create a connection to the Master Media Campaign.
Create a new custom field:
- Navigate to Setup > Object Manager > Media Campaign > Fields & Relationships.
- Click the button New.
- Select Text as Data Type.
- Click the button Next.
- Enter the following information:
- Field Label: Parent Media Campaign ID.
- Length: 255.
- Field Name: ParentMediaCampaignID.
- Description: This field relates to the Master Media Campaign.
- Help Text: Please enter the Parent Media Campaign Record ID.
- Click the button Next.
- Select the Field-Level Security for Profiles (Visible = True).
- Click the button Next.
- Select the Page Layouts that should include this field.
- Click the button Next.
You have successfully created an auxiliary field, which can be filled with the record ID of the Media Campaign.
It is recommended not to show this field in the page layout to the users.
Setup Generic Clone Configuration - General Information
Using the salesforce standard duplication button it is possible to clone a record, for instance, the user is able to copy a Media Campaign. Using the advanced ADvendio "Generic Clone" feature it is possible to copy a record and additionally clone all its child object records (up to three levels depth).
Create a new Generic Clone Configuration:
- Navigate to App Launcher > Generic Clone Configuration.
- Click the button New Configuration Setup.
- Enter all relevant information:
- Configuration Setup Name: Enter a name for your new configuration.
- Description: Enter a description, what this configuration will do.
- Object Filter: Decide, if you want to search for ADvendio Objects or also for Standard Objects.
- Select the start object to configure: Select your master object, in this case: Media Campaign (ADvendio__MediaCampaign__c)
- Click the button Continue.
In the next step, the system administrator is able to define objects, which should be cloned as well as define how to copy all relevant fields.
Setup Generic Clone Configuration - Object Information
No matter which option you have chosen before you will have to do this step. On the next screen you can select all objects, that should be cloned. Here also configure all relevant fields, and define how and if they should be cloned (Clone, Set Value etc...).
Configure objects and their fields:
- Select the Depth of Child Objects.
- Define the Cloning confirmation.
- Select Start and Child Objects, that should be cloned.
- Enter a Cloning Condition, if needed and select the Action if condition not met.
- Define the Field Configuration for every object, you have selected at Start and Child Objects, e.g.:
- Media Campaign Name: Clone with Suffix "_Alternative".
- Stage: Set Value to Alternative Quote.
- Media Campaign Name: Clone with Suffix "_Alternative".
- Click the button Save.
Generic Clone - Create Clone Button
To give users the possibility to use Generic Clone, the System Administrator has to create a custom button.
Enter the information below to generate a custom button and use Generic Clone:
Navigate to Setup > Object Manager > Media Campaign > Buttons, Links and Actions and click the button New Button or Link.
- Enter a Label.
- Enter a Name (the field Name should be filled automatically but it is possible to change the API name).
- Enter a Description.
- Select the Display Type (Detail Page Button).
- Select Behavior (Display in new windows) and Content Source (URL).
- Enter the following code into the textarea field: {!URLFOR( "/apex/ADvendio__GenericCloneProcessor", null, [id={VariableOfIdOfTheMasterRecord}, fsId={IdOfTheGenericCloneConfiguration}] ) }.
- Classic: The IdOfTheGenericCloneConfiguration can be found opening the newly saved cloning configuration and copying the URL out of the browser.
- Lightning: The IdOfTheGenericCloneConfiguration can be found opening Feature Settings and searching for Feature Name = "GenericCloneDetailConfiguration" and the Template Name as the name of the object you want to Clone. The ID is the Feature Setting Name.
- Click the button Save.
See the following code example to configure your Generic Clone feature correctly:
→ Code Example: {!URLFOR( "/apex/ADvendio__GenericCloneProcessor", null, [id=ADvendio__MediaCampaign__c.Id, fsId="a0jw0000007HIA6AAO"] ) }
Drag the new button into the page layout and the feature can be used.
The user is now able to manually enter the Master Media Campaign. It is possible to build a hierarchy, that all new created Media Campaigns are related to the previous one, but it is also possible to have all alternative Media Campaigns related to one Master Media Campaign. If you have chosen the automated process you will have to finish the implementation with the next step.
Workflow - Option 2 - Field Update to automate link to Parent Media Campaign
Create a workflow and a criteria to trigger for your workflow rule.
Select the object to which this workflow rule applies and select, what should happen:
- Navigate to Setup > Workflow Rules > New Rule.
- Select the Object: Media Campaign.
- Click the button Next.
- Enter the following information:
- Rule Name: Parent Media Campaign ID.
- Description: Check, if Parent Media Campaign is empty.
- Evaluate the rule when a record is: created.
- Run this rule if the following formula evaluates to true: ISBLANK(ParentMediaCampaignID__c)
- Click the button Save & Next.
- Add Workflow Action: New Field Update.
- Enter the following information:
- Name: Parent Media Campaign ID.
- Unique Name: ParentMediaCampaignID.
- Description: Updates the field with current Media Campaign ID while creation.
- Field to Update: Parent Media Campaign ID.
- Use a formula to set the new value: Id.
- Click the button Done.
- Click the button Activate.
While creating a Media Campaign, the ID is now available in the field Parent Media Campaign ID. This auxiliary field can also be copied using Generic Clone.
Custom Link or Button
To give users the possibility to navigate to the Master Media Campaign, the system administrator has to create a custom button or link.
Enter the information below to generate a custom button and use Generic Clone:
- Navigate to Setup > Object Manager > Media Campaign > Buttons, Links and Actions and click the button New Button or Link.
- Enter a Label, for instance "Parent Media Campaign".
- Enter a Name (the field Name should be filled automatically but it is possible to change the API name).
- Enter a Description, for instance "This custom button directs the user back to the Master Media Campaign."
- Select the Display Type (Detail Page Button or Detail Page Link).
- Select Behavior (Display in new windows) and Content Source (URL).
- Enter the following code into the textarea field: /{!ADvendio__MediaCampaign__c.ParentMediaCampaignID__c}.
- Click the button Save.
Drag the new button into the page layout. The user is now able to navigate back to the original Master Media Campaign after creating alternative Media Campaign proposals.