Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

On Jira server version 8.14, workflow, want to inspect board filter and parse data to populate Edited

On Jira server version 8.14, workflow post function, I want to inspect the board filter and parse data to populate a field value on the issue upon issue create transition.

Alternatively, if I cannot inspect board filter, can I run a JQL and inspect a returned issue to take a value in one of those issues and apply it to a field on the issue being created?

Use case: Our boards are filtered using a custom field "Scrum Team", I want to automatically upon issue create, be able to assign the "Scrum Team" value.  I will only know what value to use by either looking at the board filter or other issues already existing on the board.

Has anyone done something like this, that would be willing to share what and how they did it.  I am not a developer, but have access to developers, as I suspect any solution would require a script of some sort.  We do have scriptrunner, if another plug-in would do this more elegantly, I would be interested in hearing what those are as well.

Thank you community!

 

2 answers

1 accepted

0 votes
Answer accepted

I was actually able to come upon the answer I was looking for.  This is what I was trying to be able to do.

Using Javascript

/** * JQL Parser * *  designed to extract the required fields from a JQL query string. * * Step 1: * tokenizer() * This step breaks the string up into an array of tokens. We generate a token each time we hit whitespace or a special character. The tokenizer understands quoted  strings and escaped quotes so "Scrum Team" is a single token. *

* Using the JQL: Project = EAP AND "Scrum Team" = Redshift  the tokens would be * ["Project", "=", "EAP", "AND", "Scrum Team", "=", "Redshift"]

* * Step 2: * parseTree() * This step turns a flat array of tokens into a tree based on the usage of parenthesis. Each time we have a new parenthesis we start a nested array. Using the result of step 1 the result would be: * * ["Project", "=", "EAP", "AND", [ * "Scrum Team", "=", "Redshift" * ]]

* * Step 3: * pruneBooleanOr() * This step removes any array from the tree that contains an OR operator, there are any. If there is an OR we can't make any assumptions about the fields in that part of the tree being required. From the result of Step 2 that leaves * us with * * ["Project", "=", "EAP", "AND", "Scrum Team", "=", "Redshift"]

* * Step 4: * extractFields() * We're now left with a series of clauses that could only be joined by AND operations. We now extract required  fields by looking for the patterns "field=value" and "field in (single value)" */

Hi @Bonnie Lopes,

That looks awesome. Are you also willing to share how this solves your problem? Probably I am wrong when I understood you wanted to fill out the value for the team field based on the filter of your scrum board. How do you determine which board to look at when this field is not filled out on your ticket yet? I am very curious about that part of the solution. 

Yes Walter, our Use case is that we are doing a create from within the board itself.  As I am sure you are aware, you can create issues when you are in your board's backlog, so creating an issue from there, makes this filter available to you.

Does this answer your question?

Almost :-)

I am still puzzled - even in that scenario - how you access the board context. When I click create issue from the backlog, the create issue dialog pops up. Later on, when I do hit the create button afterwards, I'm not sure how the workflow knows where the create event came from.

Hi @Bonnie Lopes,

If I understand you correctly, you have different boards for each team that shows the issues for those teams specifically.

If so, you'll need to understand / define what makes an issue belong to each team. Maybe that is because each team works on different issue types. Maybe because it has specific assignees. Or maybe because it is in a certain Jira project. Or a certain category / application / ... is selected in a custom field.

If you have scriptrunner, you will definitely have the possibility to add a script to update your team (see for some example scripts). You will just have to be clear on what conditions apply for each team - not from your board filter, but from information you have available on your issue itself.

Hope this helps! 

Walter Appreciate the response,

It is the custom field "Scrum Team" that defines the issues that belong to a particular board.  there are no other values in any other fields that would distinguish issues between teams.  our board filters are:

project = xx and "scrum team" = yyy,

project = xx and "scrum team" = zzz

If I understand you, you are suggesting I have a second field that makes the issues unique to a specific team.  I get if I had that it would be easy to create a postfuntion based on that field to populate our scrum team field, but that is the problem, I would be in the same position on how to populate the second field as well.  

what I am trying to solve for, is if someone is creating a new issue from within a boards backlog, I should be able to inspect the other issues that reside in the backlog or inspect the board filter criteria preferably to be able to populate the data the board filter criteria is looking for.  

I know this is done on quick creates and is done on the backlogs today in that it will add the component field value to a new issue if that is the board filter criteria.

In the example link "Set issue attributes"  this is exactly what I am trying to do. Just need to figure out how to "GET" the value I want to "SET".  The data I want to "GET" would be from either the board filter or a JQL returning issues, that could then be inspected for the value.  What I am looking for it the "Get" logic.  I do not know how to "Get" the value in order to do the set command.

I see what you are trying to achieve, @Bonnie Lopes.

The problem is that an issue is not created in a board. It is created in a project. If you look at your create issue screen, you will always have to select 2 fields before you can continue:

  • the project where your issue will be stored;
  • the issue type you want to create

As you rightfully say: the issues appear on boards based on the value added in the scrum team field and not the other way around. That seems like a decision people make (manually, I presume) but is without the slightest doubt based on criteria that you must apply. And if those criteria are somehow in Jira, then you can apply that logic to automatically set the team field and make your new issues appear on the appropriate board.

So, as I tried to explain in my first answer: if your teams are working on specific Jira projects e.g., you could use those to set the appropriate scrum team automatically.

If - on the other hand - the reason why work should be assigned to a given team cannot be clearly identified from information in your ticket, it may be the best option to add the scrum team custom field to your create issue screen and make it required. That would also ensure the field is filled out and the issue will appear on the board of the desired team.

Thanks again @Walter Buggenhout _ACA IT_ , I really do appreciate the dialog on this.  As indicated, because a single team is not unique to project, I cannot use project, as I would not know which of the 5 teams that participate on that project is the correct value to select. 

Making this fields required, I know to your point would solve the issue, but this value is not always know upon issue create and when that occurs, issues are triaged and capacity of all teams are reviewed and team with capacity or best fit is chosen.  I suppose I could add Triage as a team and then when team is not know, the user could select triage. this might be a possible work-around.

Ideally though, I am trying to solve for a third party plug-in "Easy Agile Story Mapping" that when they create new stories from the story mapping board using the quick create, I wanted it to be able to populate the scrum team as it does the Project, issuetype, component and epic link, without having it pop-up looking for more info, as it was suppose to be a fast easy way to load a whole bunch of stories to a known backlog.

So, although I appreciate making the field required is a solution, it was not my first choice.  I was hoping I could be a little more tech savy and auto populate the field, cause that data is known, if I could inspect the board filter, which is what "Easy Agile Story Mapping" is doing, just not to the extent I need.  Perhaps that would be willing to share how they are doing this, so I could extend it.

Thanks again

You will keep running into the same problem that you cannot reference a board, Bonnie :-).

The Easy Agile Story Maps live inside your board and do use the data delivered by your board filter to add their story mapping features to those data. But as your board filter is based on the value you entered in the Scrum Team field, no issues will appear in your board as long as the field isn't filled out.

You describe a common use case where work is assigned to a team later then at issue creation. That makes perfect sense. And building on that, it would also make sense to build that allocating work to a team into your process and - as such - workflow. If the team can be filled out at issue creation: great! that's awesome. If not, you can include that step into the definition of done of a step in your workflow, as you suggested.

I'm sure you'll find a way around this challenge! :-)

Suggest an answer

Log in or Sign up to answer
TAGS

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you