Comala document - Approval and Tasks to both be used together for transition
Asked by Emily Guerin:

I previously had workflows where the tasks were in a previous state to the approval state to ensure that only when the tasks are complete then the approval could be collected.

However the issue I had with this was the wrong people were closing the tasks and so I thought I would move the tasks into the approval states.

This is an issue as even though I have two transitions to move states (i.e. approval and tasks completed) they seem to work in an 'OR' rather than 'AND' approach which means if either tasks are complete OR approval occurs the state is transitioned. Can I make them both apply ?

Here is a simplified version of the workflow (I would have many more tasks in the real one)

{workflow:name=Transitions to include approval and tasks\|key=spaceworkflow--938209872\|content=pages\|updatestatus=true}  
{state:Testing Sign-off\|approved=Code Review Sign-off\|completed=Code Review Sign-off\|colour=#FF5630}  
{approval:Testing Approval\|credentials=1\|rememberassignees=true\|allowedassigngroups=Jira_Developers\|selectedapprovers=Jira_Developers}  
{task:name=Development and testing Complete. Check to confirm.}  
{state}  
{state:Code Review Sign-off\|approved=Final Sign-off\|rejected=Testing Sign-off\|completed=Final Sign-off\|colour=#00B8D9}  
{approval:Code Review Approval\|credentials=1\|rememberassignees=true\|allowedassigngroups=Jira_Developers\|exclude=@Testing Approval\>approver@\|selectedapprover=Emily,Jane,Patrick}  
{task:name=Code Review Evidence\|note=Code Review evidence must be stored. Check to confirm.}  
{state}  
{state:Final Sign-off\|approved=Release Process Complete\|rejected=Code Review Sign-off\|completed=Release Process Complete\|colour=#ffab00}  
{approval:Final Approval\|credentials=1\|rememberassignees=true\|allowedassigngroups=Jira_Developers\|exclude=@Testing Approval\>approver@\|selectedapprover=Emily,Jane,Patrick}  
{task:name=Check all documentation is in place. Check to confirm.}  
{task:name=Check teams have been notified. Check to confirm.}  
{state}  
{state:Release Process Complete\|final=true\|colour=#6554C0}  
{state}  
{workflow}


Answers:
author: oliver cuesta
body: Hello [@Emily Guerin](/t5/user/viewprofilepage/user-id/4514902)

A possible workaround for your use case could be done with a couple of triggers each listening to the task completion and approval and then as a condition check through a metadata piece if the approval or the task had been completed already to make the transition.

As an example:

```
{workflow:name=Simple approval workflow|key=spaceworkflow-2069888558}
 {description}
   The Simple Approval Workflow has 2 states.
   In Progress: Staff edit pages, not visible to non-team members. Approved: Staff approve, visible to public.
 {description}
 {state:In Progress|taskable=true}
   {approval:Review}
   {task:name=Task one}
 {state}
 {state:Approved|final=true|updated=In Progress|hideselection=true}
 {state}
 {trigger:pageapproved|approval=Review}
   {set-metadata:PageIsApproved}true{set-metadata}
 {trigger}
 {trigger:pageapproved|approval=Review|@TaskIsCompleted@=true}
   {set-state:Approved}
 {trigger}
 {trigger:taskcompleted|task=Task one}
   {set-metadata:TaskIsCompleted}true{set-metadata}
 {trigger}
 {trigger:taskcompleted|task=Task one|@PageIsApproved@=true}
   {set-state:Approved}
 {trigger}
 {trigger:statechanged|state=In Progress}
   {set-metadata:PageIsApproved}{set-metadata}
   {set-metadata:TaskIsCompleted}{set-metadata}
 {trigger}
{workflow}
```

I hope that helps.

Anyway please contact our support portal for more timely response or if you want to discuss your actual workflow at <https://support.comalatech.com/>

Kind regards,

Oliver

<br />

comments: author: Emily Guerin
body: Thanks Oliver,

I have tried this and can't get it to work. I have workflows, with multiple approval states and multiple tasks at each state.

Because of the the catch all trigger of taskcompleted or pageapproved, while not giving errors is also not working.

Kind Regards, Emily


author: oliver cuesta
body: Thanks for your feedback [@Emily Guerin](/t5/user/viewprofilepage/user-id/4514902)  
To troubleshoot this issue will require more detail than is appropriate for the community. Please open a support ticket with us at <https://support.comalatech.com>, it would be helpful if you could attach your workflow in a text file to your ticket.

Kind regards,

Oliver


Tags: comala-workflows

confluence-server

server