Evolve a workflow from an on_change

I would need to evolve the workflow of a resource a from an on_change. I use the following syntax :

[...]
Model.draft(records)
[...]

but I got the error message:

psycopg2.InternalError: ERROR: cannot execute UPDATE in a readonly transaction

Is it possible ? is there an example somewhere?

You can not, on_change are readonly by design.

You should consider using a button and updating the requierd values on the transition.

BTW: If you explain us the problem you are trying to solve we may be able to give a better guidance.