Multiple approvers in workflow

hi all, id like to create a document approval workflow.

the idea is that a document must be approved by several people with no specific order, 5 approval steps with different persons wont cut it, it should be 1 approval step with multiple approvers.

any ideas on how to achieve this ?

thanks

I don’t think that’s possible. The workflow works linearly. There is only one state active at any given moment. Your approvals will need to be coded to work in sequence.

I think it could be done like this: create an approval workflow state and 2 transitions: upon every manual approval the workflow transition leads back to the same approval state for every approval. The second transition will trigger automatically when there are at least five approvals available. This way any approver can approve at any time. Only when at least five approvers made their decision the workflow will be transitioned to a final approved status. You could store the approvals as metadata or even might be able to get the approvers from the workflow object in the transition condition (I never tried that though). Anyway you probably want to save the approvers anyway so this should not be a problem.

1 Like

sounds like a good ideia, how do i make the transition star automaticly ? i also though on a tag of aproval approach where some users had special tags, when the 3 or 4 needded tags were aplliied the transition would start. i got stuck on the tag verification as i cant detect the tag using django , the example bellow allwyas returns not ok, what am i doing wrong ?.

{% if “IT Mgm Approved” in document.tags.all %}
OK
{% else %}
not OK
{% endif %}

thanks

For the tags use:

{% for tag in workflow_instance.document.tags.all %}
{% if tag.label == “WHATEVER” %}

To trigger a transition workflow automatically create a condition that checks whether 5 metadata fields are filled or the 5 tags have been attached. The workflow will automatically transition to the next state when the condition is met.

That way I can not make a condition to check if all of the tags are used. is there any place where i can get a reference for the document objects in django, a quick getting started guide would also be usefull, for example how do i assign a value to a metadata in a document from the workflow.

thanks

If you don’t mind a dirty hack you should be able to use something like this:

{% for tag in workflow_instance.document.tags.all %}
{% if tag.label == “app1” or tag.label == “app2“ or tag.label == “app3“%}
{% if not app1 %}
{% now “Y” as app1 %}
{% elif not app2 %}
{% now “Y” as app2 %}
{% else %}
TRUE
{% endif %}
{% endif %}
{% endfor %}

This should return TRUE when you found all three approval tags.

I’d love to have a guide on all of this myself. Everything I know, I learned through this forum (mainly the old one that got lost upon the upgrade) and trial end error…

1 Like

can you explain the logic behind using the now “Y” as appX

thanks

Oh that’s the hacky part: it assigns the current year to a variable that can be accessed in other parts of the template. We don’t need the year, we could also use anything else here. We only need to know that this variable has an assigned value, meaning that we already found an approval in a previous iteration of the loop. When both app1 and app2 have been assigned we know that we found the third approval and can move on (in this case return TRUE).

1 Like

Couldt we just assign a value like ‘1’ or something ?

Not unless you define your own template tags which I would not recommend. I went through all of the available standard tags and the „now“ tag is the only standard tag that allows you to create something like a global variable. The only alternative would be {%with app1=1%} but this variable only lives until the {%endwith%} block and cannot be used for our purpose within a loop because you would need to define them before the loop which is not what we want.

2 Likes