Using Loop Script Step to duplicate Records
Hoping for some guidance in doing the following:
I've written a Stocktake Solution that effectively uses 3 Tables: Products,Stocktake Batch and Stocktake Details.
As a time saver the users would like the ability to be able to take the last Stocktake Batch and duplicate that as a new Stocktake - since approx. 80% of the Products' Stock on Hand levels don't vary from month to month. [Unusual Industry].
I'm needing some help in how to do this. I can easily create the Stocktake Batch record using a Script and the Set Field Step.
I'm assuming [hoping] I can use a combination of Set Field and Loop steps to duplicate the batch, i.e.
- Use the Perform Find Step to find all Stocktake details from the previous Stocktake
- New Record Request
- Set Field
Am I on the right track? Is it possible to do this? Having never done this before, I am not sure best way to approach it.
Of course each record in the Stocktake Details table has a unique ID which I will need to avoid duplicating the GUID/UUID.
Any suggestions will certainly be appreciated.