Create multiple orders from an opportunity in Sage CRM 2017

Hi

I am trying to create several orders and associated order items programmatically from an opportunity in Sage CRM 2017 using a workflow rule. I am aware that there is the workflow rule action Execute SQL Statement. With this workflow rule action, how do I return the id of the created order so that I can populate the relevant order item with it. Is what I am wanting to achieve possible with CRM as it stands or do I need to write some custom code?