I am trying to get a sequence of automated actions working on Sales Orders placed via the WebStore context.
I have a Workflow to complete various fields that SCA does not complete be default. It appears that in order to update Line Level fields, I need to run this part of the workflow as 'After Submit' (because running them Before Submit fails to update the line level fields).
I then have a User Event script that includes the Web Store context, and needs to complete other more complex calculations based in Line Level fields that are being set by the workflow above. This is also running 'After Submit', and triggers on Create and Edit
It would seem that the Script is triggered after the Sales Order is saved ('After Submit'), but before the 'After Submit' element of the Workflow has chance to set the line level field values. The script is erroring because the fields are not set.
Is there any way to overcome this? I hoped that the 'After Submit' workflow action would be counted as an 'Edit' and trigger the script to run again (after the line level fields were set), but this doesn't seem to be the case.
One option could be to edit the current script to exclude the Web Store context, and then recreate a duplicate script just for the Web Store context. I could then attempt to update the script (copy) to update the line level fields as well, removing the need for the workflow to do this.
Before I attempt such a major re-write of functionality, it would be helpful to know if there is a simpler way to ensure the Workflow AfterSubmit triggers the User Event Script?