I need to create an automation rule that allows me compare four date picker custom fields and put the furthest one in a custom field of the same type named "Final Date".
The problem I've found is one of those fields to be compared can be empty.
Do you have any idea how can I structure this?
I have 4 data fields which I need to compare properly whenever the value of one of them changes and then select the furthest date of all and put value of it into "Final Date" field. Unfortunately if one of them has the value ‘empty’ the automaton doesn't know how to treat it so I have to add also a validation that checks if the field is empty.To do this, I need to create something like this (Example for fieldA):
----------------------------------------------------
If FieldB is empty
Or
IF FieldA is after(further) Field BAndIf FieldC is empty
Or
IF FieldA is after(further) Field CAndIf FieldD is empty
Or
IF FieldA is after(further) Field DThen put value from fieldA into "Final Date"
Do you only need the maximum value or do you need to know the specific field? If you only need the maximum value...
One way to do this is to combine the date values to form a list, and then find the maximum value. For example:
{{issue.FieldA.jiraDate}},{{issue.FieldB.jiraDate}},{{issue.FieldC.jiraDate}},{{issue.FieldD.jiraDate}}
{{varDateList.split(",").toDate.max}}
This will handle if zero or more of the dates are empty, but it will not handle if all of the dates are empty. What do you want to do in that case?
Kind regards,
Bill
Hi Bill thanks for answer, I've tried to implement what you suggested but the value is incompatible with Final Data field type.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Does your scheduled trigger have any JQL to provide issues to the rule steps?
That error message indicates your rule does not have an issue for a source of the edit.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You were right, I've corrected that and it worked.
Thanks a lot!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Sofia Grunspan
Welcome to the Atlassian community.
Can you clarify the point you are making about one of the fields being empty? Is that a permissible state? Do you want to ignore the empty fields?
What if one of the fields gets changed after the automation has run? Do you want this automation to run every time one of the fields is updated?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I've changed the explanation to be more clear:
I have 4 data fields which I need to compare properly whenever the value of one of them changes and then select the furthest date of all and put value of it into "Final Date" field. Unfortunately if one of them has the value ‘empty’ the automaton doesn't know how to treat it so I have to add also a validation that checks if the field is empty.To do this, I need to create something like this (Example for fieldA):
----------------------------------------------------
If FieldB is empty
Or
IF FieldA is after(further) Field BAndIf FieldC is empty
Or
IF FieldA is after(further) Field CAndIf FieldD is empty
Or
IF FieldA is after(further) Field DThen put value from fieldA into "Final Date"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Sofia,
I have unclicked the Accept Answer button on your behalf because I haven't actually provided an answer for you yet. :-)
I'm going to have to spend a bit of time thinking about this one.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Do you want to ignore the empty fields? yes
What if one of the fields gets changed after the automation has run? Do you want this automation to run every time one of the fields is updated? yes
I think if I put Schedule as trigger I can do that.
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.