I need to email owner when task is assigned to them. I tried following ways:
Assign
accepts a callable function which should return task owner. We can send email in this callable function. But if you read source code, you will find that this callable method is called multiple times, by calc_owner
function. Hence if we email user here, multiple emails will be send
Create a new Node method like EmailUser
and call it after Assign
and before Next
. But the issue is, it should also be thorough some callable like Assign
for it to be called for each Process
. But where to call this callable function
This seems like very general use-case, with a very difficult solution. Or am I missing something?
This functionality could be achieved in a custom subclass of flow.View, with custom activation class, where you can extend create_task
method:
https://github.com/viewflow/viewflow/blob/master/viewflow/flow/activation.py#L77
approve = (
UserTask(view.MyView)
.onCreateEmail(template='...', recipients=....)
.onAutoAssignEmail(template='...')
)