I recall seeing an article that explains in depth which workflow contexts and script contexts (both client and user event) work in which order. I can't seem to find it now (when I need it!)
I have found this article:
Execution Order of Scripts and Workflows (custhelp.com)
Which simply says:
if both the script and the Workflow is to set a value to the same field, the value that will be set to that of the field will be the value coming from the Workflow.
My problem is not workflows / scripts trying to update the same field, but the dreaded 'record has changed' error. I have 3 or 4 User Event Scripts running 'after submit' - and I assume (based on the Scripted Records page) that these are processed sequentially. There are also some 'after submit' actions on the Workflow.
Do I assume from the article above that the Workflow 'After Submit' elements will process after all the scripts have finished? Or is there a more complex sequence to how these are processed?
I believe my actual problem is an external SOAP web service (that I have not control over) - I think this is processing a change on the transaction causing an intermittent 'record has changed' error in the UI. The strange thing is, all the scripts appear to have 'try / catch' error catching on them, but I can't see any errors being logged in the Script Execution log?
The suggestion from the supplier of the web service (which is checking for transactions with a specific 'tickbox' field set to process the transaction) is that I ensure that I don't tick the relevant tickbox until all other processes are completed (which seems logical). I just need to understand where to place my code to set this tickbox - is it Workflow after submit, or User Event script after submit (at the bottom of the scripted records list).