Dear Community,
Could someone please help me with the automation I try to build?
There are several steps I need help with.
1. Comparison of values within a field. We have a customized field called "ICE Task". We can put in multiple ICE Tasks within that field. Now, I would like to compare the values of that field to be specific {{triggerIssue.customfield_10104.RELEASE}}. Would that be even possible? (The information you get from that look like: LG57_24.09.00)
2. Comparison between different fields: If 1. is possible I would like to compare the lowest release with another field called "Avaloq Release", to be specific again {{issue.customfield_10103.Name}}. The information you get from that looks like: 24.09.00
3. If 1. and 2. is possible I would like to have different actions depending of the result of the comparison.
3.1. If 2. is true then create an approval and transition work item status
3.2. If 2. is false then send an email and do not transition work item status.
I was able to make a comparison between "ICE Task" and "Avaloq Release". That looks like this: it is a smart value condition
- First Value: {{triggerIssue.customfield_10104.RELEASE}} (= ICE Task)
- Condition: contains
- Second Value: {{issue.customfield_10103.Name}} (= Avaloq Release)
Any help or tip is encouraged and greatly appreciated.
Sven
Hi @Sven Meier
What you describe is possible using text functions to extract the date from the field and then converting that with toDate, and then performing the comparisons. And if there are a list of date values, those could be examined using the list min function to find the smallest one.
Here are some documentation references to you help you do this:
If you encounter further challenges, please provide more context by posting:
Kind regards,
Bill
Hi @Bill Sheboy
First of all many thanks for your input. Then, at first it looked very promising. Unfortunately, I am still unable to find a working solution.
Secondly, unfortunately it is prohibited for some reason in our company to upload pictures. Apologies for that inconvenience.
I tried many things from the websites you kindly provided.
I tried with max and min and first and substring. Unfortunately, those I needed most to work for example min seems to not work on that customfield.
I'll explain:
We have those two custom fields:
Avaloq Release and Ice Task
- Avaloq release is a single value field, meaning just one Avaloq Release can be added
- Ice Task is a multi value field, meaning one or more Ice Tasks can be added
when you give them out they look like this:
avaloq release:
- Input 1: {{issue.customfield_10103.Name}}
- Output 1: 25.09.00
ICE Task:
- Input: {{triggerIssue.customfield_10104.RELEASE}}
- Output: LG57_24.09.00, LG57_25.03.00, LG57_24.06.00
So far I was able to compare ice task with avaloq release with a smart value condition that compares the two values.
{{issue.customfield_10104.Release}} does not contain {{issue.customfield_10103.Name}}
but in order for that to work the way I need it to, I would first need to find out which is the lowest value in ice task (in the example I used above the lwoest out of the three would be 24.06.00). Only after the lowest value was determined a comparison should be made between the avaloq release and Ice Task. Unfortunately, min-function does not work with the ice task custom field (I used {{triggerIssue.customfield_10104.RELEASE.min}} for trying to get the minimum value, please correct me if this is wrong). So, what I would need is some sort of function that either sorts them in ascending or descending order and then work with first or last respectively or a minimum function that works with that custom field or another solution I am unable to come up with :)
Kind Regards,
Sven
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for the additional information, @Sven Meier
As you cannot post images, you could also list your rule steps in bulleted text, adding any smart values used, and copy-and-paste the audit log results. That context will provide some context for what you are trying.
Back to your question...
You are correct the min function works on number and date / time values, and not plain text. And, because one of the fields is multiple-selection, JQL cannot be used to solve this because it would sort on groups of selections, not the individual selections.
Fortunately, the part you want to compare only contains digits and periods, and so that could be converted into a number using text functions, and then the min function may be used. This approach will work for Jira Cloud, but not for Server / Data Center versions, as they do not have the asNumber function.
For example, assuming your ICE Task field is multiple-selection, option type:
{{triggerIssue.customfield_10104.value.substringAfter("_").replace(".", "").asNumber.min}}
How that works is:
If your field is another type, please adjust the expression accordingly.
Similarly for the avaloq release field, you may remove the periods, convert to a number, and then compare to the above result for equality.
As noted above, this works for Jira Cloud. The workaround for Server or Data Center versions would use a math expression to find the minimum value:
{{#=}} MIN ( {{triggerIssue.customfield_10104.value.substringAfter("_").replace(".", "").join(", ")}} ) {{/}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Sven Meier
Just following up to check if this answered your question. If so, please consider marking this one as "answered". That will help others with a similar need find solutions faster. If not, please let the community know what help you need with the rule changes.
Thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Bill Sheboy
Unfortunately it did not quite workout yet. I am currently fighting with IT and compliance that they let me upload pictures.
FYI:
I tried many versions of what you put above:
1
{{triggerIssue.customfield_10104.RELEASE.value.replace(".", "").asNumber.min}}
Result: nothing
2
{{triggerIssue.customfield_10104.RELEASE.value.substringAfter("_")}}
Result: nothing
3
{{triggerIssue.customfield_10104.RELEASE.replace(".", "").asNumber.min}}
Result: nothing
4
{{triggerIssue.customfield_10104.RELEASE.substringAfter("_")}}
Result: nothing
5
{{triggerIssue.customfield_10104.RELEASE.substringAfter("_")}}
Result: nothing
6
{{triggerIssue.customfield_10104.RELEASE.join(" - ").substringAfter("_").replace(".", "")}}
Result: 240900 - LG57_250300 - LG57_240600
7
{{triggerIssue.customfield_10104.RELEASE.join(" - ").replace(".", "").substringAfter("_")}}
Result: 240900 - LG57_250300 - LG57_240600
8
{{triggerIssue.customfield_10104.RELEASE.substringAfter("_").replace(".", "")}}
Result: nothing
9
{{triggerIssue.customfield_10104.RELEASE.replace(".", "").substringAfter("_")}}
Result: nothing
10
{{triggerIssue.customfield_10104.value.substringAfter("_").replace(".", "").asNumber.min}}
Result: nothing
11
{{triggerIssue.customfield_10104.RELEASE.substringAfter("_").replace(".", "").asNumber.min}}
Result: nothing
12
{{triggerIssue.customfield_10104.RELEASE}}
Result: LG57_24.09.00, LG57_25.03.00, LG57_24.06.00
Best,
Sven
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for that information, @Sven Meier
Let's confirm something: what is the field type for customfield_10104? I ask this question as the built-in fields do not have an attribute named RELEASE, and thus I suspect this is an asset object. Is that the case?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Bill Sheboy I hope you are able to see the picture now. So, yes from my understanding it is an asset object.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks, @Sven Meier as this may indicate there is a timing and / or typing problem. My understanding is some data in rules such as Assets are looked up just-in-time rather than instantly and always available.
We may test this using a Created Variable. That will force full evaluation / loading of the information before the rule continues, converting the values to text.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.