Remove label from closed issues

Sandro Silva August 2, 2017

Hi, 

I've an automation that should delete a label from issues that are in closed or resolved status.
The question here is that the workflow does not allow changes once the issue gets to close or resolved status.

Is there a way that automation bypass this "restriction" and be able to delete a label from that issues?

Thanks.

2 comments

Comment

Log in or Sign up to comment
andreas
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.
August 2, 2017

Hi Sandro,

So Automation for JIRA actions still execute in the context of a user (the rule actor).  We have to - since most  of JIRA's internal APIs expect a user to exectue an action.

As such we are also bound by the same permission checks and validation that JIRA performs normally.  So if an issue is marked as *not* editable by the workflow, then I'm pretty sure the 'Edit issue' action in Automation for JIRA will also not be able to edit this issue (and therefore can't remove a lable).

The only way around this I think would be to use security levels somehow instead of workflow to disallow editing of closed issues, so that only the Automation for Jira rule actor is in a security level that allows issues to be edited, and then setting that security level whenever an issue is closed.  It's a bit complicated to setup though s not sure this is a great solution.

Hope this helps.

Cheers,

  Andreas

David Fischer
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 2, 2017

Hi Sandro,

for your information, the JIRA Misc Workflow Extensions (JMWE) add-on doesn't have this limitation, neither on JIRA Cloud nor on JIRA Server. But you probably don't want to have to buy or subscribe to another add-on just for this.

David.

andreas
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.
August 2, 2017

Hi David,

I'm curious, how do you get around this limitiation in Cloud?  You'd have to use the REST API, which means you'll be subjected to JIRA's permission checks?

Cheers,
  Andreas

andreas
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.
August 2, 2017

Ah I see, because JMWE uses workflow post-functions, to edit the fields, which would require editing the workflow to set this up correct?

David Fischer
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 2, 2017

Hi Andreas,

yes, JMWE provides post-functions. But I'm not sure I understand what your question meant. We do use the REST API though.

David

andreas
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.
August 3, 2017

Hey David,

Well so I think it works, since the post-function will call the edit issue REST API *before* the non-editable property has been set.  

If you try to use the REST API *after* the workflow transition has completed (and the non editable property was set by the workflow), then the edit via REST API should not be able to succeed, since internally that goes through the issue service which will check if the issue is in an editable state.

Cheers,
  Andreas

andreas
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.
August 3, 2017

I'm talking about the 'jira.issue.editable' workflow property btw (https://confluence.atlassian.com/adminjiraserver071/workflow-properties-802592825.html), which is what I'm assuming @Sandro Silva used to make the issue not editable in the resolved or closed states.

Also see: https://confluence.atlassian.com/jira/allow-editing-of-closed-issues-138704.html

David Fischer
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 3, 2017

Hi Andreas,

I'm going to be a nice neighbor (i.e. fellow add-on vendor) and point you to the overrideEditableFlag of the Edit Issue REST endpoint :)

Cheers,

David

Sandro Silva August 4, 2017

Hi @andreas,

yes, that's right we are using the  'jira.issue.editable' workflow property to disable editing.
The workflows are managed by development teams so I can't change it.
Thanks to all for you answers.

Cheers,

Sandro

andreas
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.
August 4, 2017

Thanks @David Fischer. Wow I did not know about this flag.  I've raised https://codebarrel.atlassian.net/browse/AUT-458 now for us to implement support for it in future @Sandro Silva.  

We've got quite a few higher priority items in our backlog at the moment so it will be a while before we can get to this, but we'll let you know when we get a chance to work on this.

Sandro Silva August 4, 2017

Great!
It will very usefull, for sure!

Thanks @David Fischer and @andreas.

Sandro Silva August 14, 2017

Hi @andreas@David Fischer
I've been triyng to implement a workaround using the flag mentioned but it is only available for JIRA Cloud REST API. For JIRA Server that flag doesn't exists.
Maybe that's the reason Automation is failing me.

Well just for you to know. Hope that in a near future automation is able to bypass this restriction.

Regards,

David Fischer
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 14, 2017

Hi Sandro,

i didn't realize you were on JIRA Server. You are right, the JIRA Server REST API is slightly different. 

In the case of JMWE, we don't have that issue because JMWE for JIRA Server is based on JIRA's Java API which has much fewer restrictions. 

David

andreas
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.
August 14, 2017

Hi @Sandro Silva@David Fischer,

We also use the Java APIs in server and not REST so we'll be able to implement this using the Java APIs as well.  We just have to get around to implementing it.  

We still have quite a few higher priority items in our backlog currently unfortunately so it will be a little while.

Cheers,

  Andreas

TAGS
AUG Leaders

Atlassian Community Events