Restart approvals after adding an attachment

SyntheZ January 27, 2020

Hello!

I am using JIRA Software and JIRA Service Desk both server versions.

I developed a project to automate documents approvals step-by-step by different users (from different departments). Now I need to make the whole approval process to restart from beginning if somebody have added an attachment.

Use case: some users have approved the document then somebody made some changes and now everyone have to read the new document and approve it again because there are some changes.

In other words: I need to trigger workflow transition upon adding an attachment.

How could I do that?

I would appreciate any suggestions as I'm struggling with that task for few days now.

1 answer

0 votes
Thomas Deiler
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 27, 2020

Dear @SyntheZ ,

without investing in add-ons you need to have some technical skills.

One idea (less coding/less elegant):

When someone adds an attachment, an event is triggered. The sent email could be caught, parsed for issue / attachment information and then call a

POST /rest/api/2/issue/{issueIdOrKey}/transitions

to start the approval process (specific status) from new.

Another idea (more coding /but elegant):

Write your own add-on that directly fetches the event of Jira. This should not be a big deal - the are some general tutorial and the SDK from Atlassian.

So long

Thomas

SyntheZ January 27, 2020

Hi Thomas thanks for your reply. Unfortunately I am not confident with coding and developing my own add-on.

But first idea sounds good for me however could you please give me more details about that? What kind of event is triggered and how do I catch it? How do I call that POST especially when I don't have an issue ID or key because there might be lots of them new and old as well.

Thanks in advance.

Thomas Deiler
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 28, 2020

Dear @SyntheZ ,

the Rest API POST call is simple. First you need to figure out how and if you can fetch the event.

Adding an attachment throws an "Update Issue Event". The fired mail contains the issue key, the "issue updated" and "attachment" as key words.

When you can write a filter for those mails, then the REST is piece of a cake. :)

POST https://jira.mydomain.com/rest/api/2/issue/<issue_key>/transitions

as body send this JSON:

{
"transition": {
"id": "123"
}
}

The corresponding ID to one transition can be figured out by UI or another Rest Call.

So long

Thomas

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events