I want to create a work queue entry (and send notification) only after other ‘on status change’ workflows are executed - because in notifications i need the value computed by such a workflow.
I can imagine a number of workarounds - e.g. create a column ‘EnteredDate’ - which would be updated at the workflow and create a work queue entry based on updating that value. But there is a redundant column then. Or create one more status - but then there is a one more status which would be confusing for users.
Or to isolate the needed computing functionality to workflow and call it by DataStructure Workflow Method - so that it’s available for notifications.
Isn’t there some more straightforward way? Is there any reason why a creation work queue entry preceded other event state machine actions?
The reason why work queue entries are added first is that work queues can update the record, thus the entry, while being processed. Before the work queue entries were added after the events but that resulted in the entry being out-of-date. E.g. record was created and the subsequent event would update the
InvoiceNumber field with a serial number. The work queue entry was left without this.
Maybe the events would even result in other entries being added, so it makes some sense to add the work queue entry as soon as possible before other processing.
The truth is that this does not work well with the notifications.
All the possibilities you offer are valid. Although you do not have to show the values to the user if that would be confusing.
Although the problem is not the queue entry being created too soon. It is the notification that is sent immediately after the queue entry is created.
As the creation of the queue entry runs under a transaction, I think the notification should actually be sent after the transaction is committed, which is not the case right now. So it could even happen that the transaction will be rolled back but notification being already sent out.
I think we should change this behavior in such a way, that the notifications are sent after everything is committed.
Yes, you are right. The problem is the notification is sent too soon. The suggested change of behavior would really solve my current problem.