Working with Approvals from groovy script

SaidAslan March 26, 2017

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 votes
JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 28, 2017

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...

SaidAslan March 28, 2017

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

JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 28, 2017

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

Or is it just standard workflow stuff?

SaidAslan March 28, 2017

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 :| 

 

JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 28, 2017

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.

SaidAslan March 29, 2017

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
TAGS
AUG Leaders

Atlassian Community Events