Sometimes you need to clone records. Often people reach for the developer when this requirement comes up but you can get quite far with workflows as long as child records are not involved.
On Demand Workflows
Given this is a workflow which does not trigger off of an event but will be called by the user, we will use an on-demand workflow. Also, as there s no need to have it run immediately, we will run it in the background.
In this case I am cloning an Opportunity record but you can do this with any entity which a workflow can run off.
As you can see, the steps are very simple as there is only one, which is the creation step for the new Opportunity.
Creating the Clone Opportunity
The beauty of this approach is we get a lot of control on what gets copied and what does not.
In this case I append “- Copy” to the cloned Topic. I also add “Previous Opportunity Notes:” to the description boxes to avoid confusion. In the case of date fields we can project them forward or choose not to copy fields at all e.g. Actual Close Date.
Once we have populated all the fields we want to copy with their slugs, we publish and we are ready to go.
Running the Workflow
To run the workflow we either select our target record from a View or open the record and select “Run Workflow” from the Menu Bar.
Sure enough, our On Demand workflow appears.
Running it then creates our record which, in a few seconds, will appear in our Opportunity View.
Conclusions
If you need a simple clone feature without code, this will do the job. What’s more it brings the power of the workflow Create step to bear allowing us to do some simple manipulation before copying.
Very easy to implement, very easy to maintain, and much cheaper than a developer.
You are able to clone the opportunity without the opportunity products.
LikeLike
For some reason the text ‘ – copy’ appended to the topic is not showing up in the cloned record. I tried multiple times. Can you please point out if I am missing anything?
LikeLike
I’m not sure why this is happening. If your screen looks like my screenshot above it should be ok.
LikeLike
For some reason mine created 12 copies. Any idea why that would happen?
LikeLike
It means the Workflow is being triggered 12 times. See what the triggers are for the workflow, and whether there is an infinite loop happening.
LikeLike
Great article. Thanks.
Do you know if I can set this workflow to clone a set number of opportunities?
For example if I have a field where I state the number required. Then it uses this in the workflow?
LikeLike
These days I’d probably look to do it with Power Automate which has in-built looping structures. To do it in Workflows, you’d need the workflow to call itself, thereby making a loop, and increment a test value sitting in a field.
LikeLike
I wanted to use the Javascript to clone the record and open that in new window. found so many articles but none of them were explaining much. To achieve this thing using Javascript you can follow this article.
https://blog.infobitsoft.com/2020/04/how-to-create-clone-record-using-Javascript-in-MS-Dynamics-365.html
LikeLike