Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,369,731
Community Members
 
Community Events
168
Community Groups

Conditional User based on group in Comala

Hi, 

I'm new to Comala Workflow Document, I want to set an approval macro based on creator,

which means that if the creator is in group A (group of confluence users define in confluence), the approver must be User 1, if the creator is in group B, the approver must be User 2.

how can I write these conditions in approval macro? is it possible?

Please help. Thanks

 

1 answer

1 accepted

2 votes
Answer accepted

Hello @Maahshid Vaziri 

Please find below one potential approach, you will need to replace the lines with <angle brackets> with the correct values

{workflow:name=Conditional Approver Example}
{workflowparameter:Approver 1|type=user}
<Approver 1 user name>
{workflowparameter}
{workflowparameter:Approver 2|type=user}
<Approver 2 user name>
{workflowparameter}
{workflowparameter:Creator Group A|type=group}
<Creator Group A name>
{workflowparameter}
{workflowparameter:Creator Group B|type=group}
<Creator Group A name>
{workflowparameter}
{state:In Progress|approved=Approved|taskable=true}
{approval:Review|user=@Approver@}
{state}
{state:Approved|final=true|updated=In Progress|hideselection=true}
{state}
{trigger:pagecreated|group=@Creator Group A@}
{set-metadata:Approver}@Approver 1@{set-metadata}
{trigger}
{trigger:pagecreated|group=@Creator Group B@}
{set-metadata:Approver}@Approver 2@{set-metadata}
{trigger}
{workflow}


Note that this only works in Space Mode with Pages (not blogs) on newly created pages. If you have more complex requirements, for example you have existing pages that you want to follow a similar rule, please could you open a ticket with us at https://support.comalatech.com

Kind regards

James

Many thanks, @James Conway, I think it gonna work.

one other question I've, I create Groups in Confluence, Should I create workflow parameters again or I can call it only?

and Just for info, if I set Metadata, shouldn't I use the get-metadata macro when I want to get and use it?

@James Conway 

I set this trigger in the markup so that when the page is created, the approver is also specified, but when the page is created in space, no one is assigned the approval.

{workflow:name=Simple Approval |key=spaceworkflow-1119345224}
{description}
A Simple Approval Workflow, a page's state can be for 'Review','Approved' or 'Rejected'. Only 'Approved' pages are visible to Read-Only users.
{description}
{pageheader}
||Owner|@creator@|
{pageheader}
{workflowparameter:Approver 1|type=user}
admin
{workflowparameter}
{workflowparameter:Approver 2|type=user}
K.Sh
{workflowparameter}
{workflowparameter:Creator Group A|type=group}
Comfort
{workflowparameter}
{workflowparameter:Creator Group B|type=group}
PMT
{workflowparameter}
{state:Editing|approved=Approved|rejected=Rejected|taskable=true}
{approval:Technical|user=@Approver@|exclude=@creator@}
{state}
{state:Approved|final=true|updated=Editing}
{state}
{state:Rejected|updated=Editing|taskable=true|colour=#FF5630}
{approval: Design}
{state}
{trigger:pageapproved|approval=Editing|partial=true}
{send-email:user=@creator@|Subject=Your recent Review Group approval}
Your Page Has been Approved By @approvalassignees@
{send-email}
{trigger}
{trigger:pagecreated|group=@Creator Group A@}
{set-metadata:Approver}@Approver 1@{set-metadata}
{trigger}
{trigger:pagecreated|group=@Creator Group B@}
{set-metadata:Approver}@Approver 2@{set-metadata}
{trigger}
{workflow}

Hello @Maahshid Vaziri 

One -  I create Groups in Confluence, Should I create workflow parameters again or I can call it only?

Two - if I set Metadata, shouldn't I use the get-metadata macro when I want to get and use it

Three - no one is assigned the approval.

  • The specified user will be able to approve when they log in however you will not see them as 'assigned'. If you want to see them as assigned then you need to make two changes:
  1. Add a new state called 'Start' that submits the page to 'Editing' - this initialises the approval and assigns the approver
  2. Specify the approval as 'auto assigned' using the & character
  • The changes will look like:
...
{state:Start|submit=Editing}
{state}
{state:Editing|approved=Approved|rejected=Rejected|taskable=true}

{approval:Technical|user=&@Approver@|exclude=@creator@}
{state}
...

If you have further questions, you'll get a more timely answer by contacting our friendly Customer Success team at https://support.comalatech.com

Kind regards

James

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events