Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to restrict workflow transition to "Automation for Jira"?

Mashu Duek
February 12, 2021

Info: Free tier, Next-gen software project

ISSUE:

When creating a git branch I am moving a card from "SELECTED FOR DEV" to "IN PROGRESS" through an automation trigger. I would like to be able to limit that transition so that the only one who can move it is the actor of that trigger (the Jira bot). Jira defaults the actor of the trigger to be "Automation for Jira". 

ATTEMPTED: 

I've visited Project Settings -> Access to see if I could find the user Automation for Jira, in hopes of being able to apply the restriction to Admin users only, but Automation for Jira is not there.

Screenshots:

Transition restriction popup window:

Screen Shot 2021-02-12 at 3.59.39 PM.png

Automation Rule displaying the Actor (unchanged from default):Screen Shot 2021-02-12 at 4.04.47 PM.png

1 answer

1 accepted

0 votes
Answer accepted
Nic Brough -Adaptavist-
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 Champions.
June 9, 2014

This is exactly what workflow validators are for - they'll throw a "pass" or "fail, with error message".

But those only happen in the workflow. Other events (such as comment, edit, add workflow etc) do NOT have any validators you can hook into. You can make listeners that catch them, but it's too late at that point and there's no feedback to the users.

Pylypenko Artem
Contributor
June 10, 2014

Thank you for quick replay, can you help me with one more question - is it possible to validate Issue Links on 'creation' step with workflow validator? I need to be sure that user will choose at least one 'implements' link.

Nic Brough -Adaptavist-
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 Champions.
June 10, 2014

Yes, you can, as long as you have the "links" field on screen for them (that is only available on later versions of Jira). When your validator runs, it has access to the current issue data (which is empty for new issues) and the data the user has entered. So you can indeed iterate through all the links the users have added, have a look at their type and return a "fail" if you don't find any called "implements"

Pylypenko Artem
Contributor
June 10, 2014

Can you please be more specific.
I've tried to find links that user added with ComponentAccessor.getIssueLinkManager().getOutwardLinks(issueId) inside my validate() method.
This only gives me NullPointerExecption, I guess it's because the Issue is not yet created and ComponentAccessor dont know about this Issue.
Can you tell how exactly I can obtain 'Linked Issues' field values in 'Create Issue' dialog window?

Pylypenko Artem
Contributor
June 10, 2014

Can you be more specific.
How can I get information from this field. I used issue.getExternalFieldValue("issuelinks") and it's gave strange Object. How to obtain real data from it, to what class I need to cast it?

Nic Brough -Adaptavist-
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 Champions.
June 10, 2014

It's a list of link objects, not a case of casting it, but iterating through the list and reading each link object for its type.

Pylypenko Artem
Contributor
June 10, 2014

List of IssueLink's ?

List<IssueLink> links = (List<IssueLink>) issue.getExternalFieldValue("issuelinks");

gives exception :
com.atlassian.jira.issue.fields.IssueLinksSystemField$IssueLinkingValue$Builder$1 cannot be cast to java.util.List

how can I iterate through such object?

Nic Brough -Adaptavist-
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 Champions.
June 11, 2014

Sorry, no, I'm going in the wrong direction there. Although I've said use the links field, it's not really a field, it's a place to capture links. You should be able to iterate through the links on the incoming issue. However, I've only ever done this with something linke issueLinkManager.getLinkCollection(issue, user) on existing issues, so I'm not entirely sure itl work on create.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events