Working with Approvals from groovy script

Hi all, 

We are on JSD v.3.2.6 now and would like to move our current standart approval process to the new one. We have our own approving process with approving by email (from project automation)

As I understood after a few tests, when enable new Approvals, jira's project automation module became useless for transitioning issue on this status. 

Now I need to write a script to do something like automation does: 

if last comment contains @approve then transition issue as approved, 

if last comment contains @decline then transition as declined. 

Maybe anybody did the similar thing?  

Or how I can be done using service desk api?

Thanks

1 answer

0 vote

I think you just want a script listener listening for Issue Commented, then:

if (event.getComment().body.contains("@approved")) {
    issueService.validateTransition(...)
}

Lots of examples here about how to do the transition...

Hi Jamie, 

Thank you for your answer! 

Actually my question is about how to transition Approvals as if the user enters the portal and clicks on the button Approve or Decline. 

For example, I've tried to do this with scriptrunner's Escalation service (for a test I've just transitioned issue (Approve) without any conditions). While running it, if select skipping Conditions/Validators/Permissions it transitions the issue, but Approve / Decline buttons stay on the display for approvers, and this person is pending with 1 approval needed

Is this Approval stuff a new feature of JSD? If so got a link to the docs?

Or is it just standard workflow stuff?

yes, I try to work with new JSD 3.2 approvals. I cannot find their api, (tried to find here https://docs.atlassian.com/jira-servicedesk/3.2.0/ sorry for such a stupid question ) and there are no any examples how to work with it :| 

 

OK I found https://confluence.atlassian.com/servicedeskserver032/setting-up-approvals-834219423.html - but I'm not sure if this is done with workflows or something new. Sorry, I am out of date on JSD.

Yes I have read it, but there is no information about how to work with them from the script side.

Anyway thank you smile

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Published Apr 19, 2018 in Marketplace Apps

Calling all developers––You're invited to Atlas Camp 2018

 Atlas Camp   is our developer event which will take place in Barcelona, Spain  from the 6th -7th of   September . This is a great opportunity to meet other developers and get n...

366 views 0 6
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you