Comala document management (cloud) and custom notifications when document is rejected
Asked by Daniela Pbrand:

Hi,

I'm configuring Comala Document Management and I want the document owner to be notified if the document is rejected. Here's my script, I've tried a number of things (like stating the actual email or updating the email permissions of the approver) but it does not work. Not email. The other thing I noticed is, although stated in the script, that if the document is rejected it does not automatically change to the review state. Can anyone help with this?

Script:

{  
"name": "Approval Workflow KMS with Message - Draft",  
"id": "custom",  
"description": "A simple workflow for Draft/Review/Approved/Rejected content in the draft workspace",  
"HTMLdescription": "A simple workflow for Draft/Review/Approved/Rejected content. The initial state of the page is Draft. If the document is reviewed and approved, it transitions to the Approved state. If it's rejected, it goes to the Rejected state.",  
"states": \[  
{  
"name": "Draft",  
"transitions": {  
"select": \[  
"Review"  
\]  
},  
"colour": "#FFAB00",  
"approvals": \[\]  
},  
{  
"name": "Review",  
"colour": "#0052CC",  
"taskable": true,  
"transitions": {  
"approved": "Approved",  
"rejected": "Rejected"  
},  
"approvals": \[  
{  
"name": "Approval",  
"preassignedUsers": {  
"items": \[  
"712020:7477d2ed-2672-4b5b-90df-25b2e82eb7d6"  
\]  
},  
"minimum": 1  
}  
\]  
},  
{  
"name": "Approved",  
"transitions": {  
"Published": "Published"  
},  
"colour": "#4a6785",  
"final": false,  
"versionsCompleted": false  
},  
{  
"name": "Rejected",  
"transitions": {  
"Review": "Review"  
},  
"colour": "#FF5630",  
"approvals": \[\],  
"triggers": \[  
{  
"event": "on-reject",  
"actions": \[  
{  
"action": "send-email",  
"recipients": \[  
"@creator"  
\],  
"notification": {  
"subject": "${content.title} has been rejected",  
"title": "${content.title} has been rejected by the approver",  
"body": "Hello, ${content.link} in the ${content.space} space has been rejected and needs to be reviewed. Please resolve any comments added by the approver and re-submit the document."  
}  
},  
{  
"action": "set-message",  
"type": "info",  
"title": "Rejected",  
"body": "The page has been rejected",  
"tags": "state",  
"mode": "autoClose"  
}  
\]  
}  
\]  
}  
\]  
}


Answers:
author: Sandeep Saluru _Appfire_
body: Hi [@Daniela Pbrand](/t5/user/viewprofilepage/user-id/5326257)

Please find the below workflow schema which is working, the email is triggered to the creator of the page when the page is rejected.

```
{
"name": "Approval Workflow KMS with Message - Final",
"id": "custom",
"description": "A simple workflow for Draft/Review/Approved/Rejected content in the draft workspace",
"HTMLdescription": "A simple workflow for Draft/Review/Approved/Rejected content. The initial state of the page is Draft. If the document is reviewed and approved, it transitions to the Approved state. If it's rejected, it goes to the Rejected state.",
"states": [
{
"name": "Draft",
"transitions": {
"select": [
"Review"
]
},
"colour": "#ffab00"
},
{
"name": "Review",
"colour": "#0052CC",
"taskable": true,
"transitions": {
"approved": "Approved",
"rejected": "Rejected"
},
"approvals": [
{
"name": "Approval",
"preassignedUsers": {
"items": [
"712020:7477d2ed-2672-4b5b-90df-25b2e82eb7d6"
]
},
"minimum": 1
}
]
},
{
"name": "Approved",
"transitions": {
"select": [
"Published"
]
},
"colour": "#ffab00"
},
{
"name": "Rejected",
"transitions": {
"updated": "Review"
},
"colour": "#FF5630"
},
{
"name": "Published",
"colour": "#14892c",
"taskable": true,
"transitions": {
"updated": "Review"
},
"final": true
}
],
"triggers": [
{
"event": "on-reject",
"actions": [
{
"action": "send-email",
"recipients": [
"@creator"
],
"notification": {
"subject": "${content.title} has been rejected",
"title": "${content.title} has been rejected by the approver",
"body": "Hello, ${content.link} in the ${content.space} space has been rejected and needs to be reviewed. Please resolve any comments added by the approver and re-submit the document."
}
},
{
"action": "set-message",
"type": "info",
"title": "Rejected",
"body": "The page has been rejected",
"tags": "state",
"mode": "autoClose"
}
]
}
]
}
```

The reason it wasn't triggered for you is the trigger is placed inside the Rejected state. It should be placed separately, outside the state.

Regarding: *if the document is rejected it does not automatically change to the review state*

As per the above workflow, once the page is rejected, you should update it and then it automatically changes to the "Review" state. If you want the page to go to review directly when it is rejected without updating the page. You can change the transition in the Review state as below:

```
 {
"name": "Review",
"colour": "#0052CC",
"taskable": true,
"transitions": {
"approved": "Approved",
"rejected": "Review"
},
```

Let us know if you have any questions.

Regards,

Sandeep


author: Sandeep Saluru _Appfire_
body: Hi [@Daniela Pbrand](/t5/user/viewprofilepage/user-id/5326257)

We are from the Appfire support team and would like to inform you that we have created a support request <https://appfire.atlassian.net/servicedesk/customer/portal/11/SUPPORT-125618> on your behalf in our portal. Request you to sign up into the portal and let us know the username so that we can mark you as the reporter to be able to access the ticket.

Please find the link <https://appfire.atlassian.net/servicedesk/customer/portal/11> to sign up for the portal.

Regards,

Sandeep


Tags: cloud

confluence-cloud