I'm not sure where to start for this automation attempt:
I have custom field (single select, string) indicating a delivery cycle for the work item (e.g. 2021-Q4-1). This field is set both at Story and Epic level and I'd like to write a rule that checks consistency, that is that the Story level value is no later than what is in Epic. The format of those strings is such that alphanumerical comparision (grater, equal, smaller) would be the right one for me. Is this possible to write such a rule?
Interesting question you've got there!
I would approach your problem with a slightly different angle, and instead of comparing the values on the right I would compare the option ids of your single select field. That is if you have the ability to set it up like below:
id | value |
1 | 2021-Q1 |
2 | 2021-Q2 |
3 | 2021-Q3 |
4 | 2021-Q4 |
5 | 2022-Q1 |
6,7,8,9...... | etc |
What I would do is to actual compare the id of the selected value, instead parsing the text inside your value. So e.g. if I had set up a rule either in automation or within a workflow (with the use of an app) I would check the relation between the two selected values of the field in both story and epic. If the id of the value in story is greater than that of the Epic then:
Would something like the above work for you?
@Alex Koxaras _Relational_ In terms of ids (I assume "id" is what is called "position" in the custom field value definitions) then yes, I can control that and it's already in right order, so if the ids are somehow accessible then comparing them is an option.
I don't know much about automation (only created couple of simple rules) so could you please advice how would I approach this task?
What I want is a scheduled job (schedule trigger) that will send an email or slack message with those issues that doesn't match. I thought I could use scheduled trigger with JQL query selecting a Stories I'm interested in. But then I'm not sure how to reach to parent and do the comparison.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You could either use REST API to retrieve this single select ID, or use a 3rd party app, like JMWE or scriptrunner to do the comparison on the create screen of your story workflow, or use smart values within a Jira Automation. The latter could be easier.
For example you could do the following with Jira automation:
And then on the audit log you would have these results:
Thus having two integers value to compare!
Happy ending, no? :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Alex Koxaras _Relational_ thanks a lot! I'm in the middle of testing it and I noticed that the ids are not the positions (in the custom field administration) but they are very high numbers (e.g. 12131) which looks more like global counter? Fortunately they seem to be in the right order, likely becuase of the creation time/order (if they are global order indeed) but once created they cannot be influenced I guess, is that correct understanding?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes they will not change, unless you delete a value and create another
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Alex Koxaras _Relational_ thank you very much for help, I think I managed to make this working (thankfully the ids are in right order). Out of curiosity and without needing to show this exactly, would the string comparison be doable in jira automation or one would need more external approach using e.g. API?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes it's doable with smart values. If you go to the link I provided a few comments above. you'll find on your right a selection that has to do with string manipulation etc. Read it, since it has some interesting functions!
Kindly mark my answer as accepted, in order to help others in the community to find proper answers.
Thanx and be well!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.