Blog, Tools, Ultimate Workflow Toolkit

UWT: Cloning record with related records with no code

After I wrote previous post regarding copying of N-N related records I got reasonable question – why have I used Action in this scenario if it is possible to implement it without it using just “Distribute Workflow” step and On-Demand workflow. I agreed that this is possible. So here is other scenario that can’t be implemented without additional Action and “Distribute Action” step – cloning of record with N-N related records.

Let’s use the same Lead and Industry entities and implement cloning of Lead with copying of related Industries into destination entity.

Create “Industry” related action:

Add “Entity Reference” input with “Lead” as a target entity:

After that add “UWT: N-N Operations: Associate Entities” step from Ultimate Workflow Toolkit:

and configure it:

set “Record 1 Reference” to “Url” for Industry, “Record 2 Reference” to “Url” for Lead and “Relationship Name” to name of relationship between “Lead” and “Industry” (uwt_industry_lead) in my case.

Activate Action and close it.

Create “Lead” related workflow:

Remove all triggers and mark is as “On Demand” workflow.

Add “Create Record” Lead step and map fields you want to be cloned:

With the next step start the preparation of special “Request” object that will be used in further steps – add a “UWT: Request Builder: Set Lookup Field” step to workflow:

and then configure it:

where “Field Value” is a reference to “Cloned” lead created on first step of workflow, “Field Name” – name you give to “Lead” Input from Action you created on step 1. Leave “Request” field blank – it is used when you have multi-step population of fields of “Request” object.

The next step is to add “UWT: Bulk Operations: Distribute Action” step to workflow:

Here is how you need to configure it:

Set “Request” to “Modified Request” output of “Set Lookup field” step, populate “Action Name” with “Unique Name” of Action you created in a first part, pass “Url” of “Lead” for which workflow is executed (and not one that was created in it) and set “Relationship Name” to uwt_industry_lead. Save and Activate your workflow.

So that’s it – let’s check it in action:

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.