Hello, I am using a sql action in a workflow to create records in a workorders table. This table also contains a sequence field for the workorder number. However, it seems like the sequence field is not working when creating records this way. Could this functionality be added, or is there another workaround I could use?
To update / create sequence field by SQL is not supported, because sequence field depends on the collection event (which on ORM layer). And all SQL action is directly effecting in DB.
The workaround could be like this:
- You find the sequence field record in
sequeces
table by collection name and field name. - Get the
current
value of the record. - Update the
current
value by +1. - Use the new current value in your sequence field as the auto incremental part.
So, we highly recommend not to modify the sequences records, which are managed by plugin. And if you want to create a record, the better way is to use the create node.