In this post I will provide instructions how you can copy N-N related records using latest release of Ultimate Workflow Toolkit without any code.
Let’s consider typical scenario – qualification of Lead. Both Lead and Account have N-N relationship with entity Industry. When user wants to qualify Lead – Industries that are related to it have to be copied into Account that is created during qualification. Here is how it can be done:
Create “Industry” related action:
Add “Entity Reference” input with “Account” 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 Account and “Relationship Name” to name of relationship between “Account” and “Industry” (uwt_industry_account) in my case.
Activate Action and close it.
Create “Account” workflow that should be executed on its “Create” event:
As a first step add a check that Account was created from Lead – “Originating Lead” has to contain value and if it does not – just stop the workflow execution:
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 your account, “Field Name” – name you give to “Account” 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 “Originating Lead” field of current account and set “Relationship Name” to uwt_industry_lead (this is the name between Industry and Lead in my case). Save and Activate your workflow.
So that’s it – let’s check it in action: