Hi,
I want to execute an automation action based on a custom field value change.
What I have set up now:
Trigger:
When: Value changes for "Field A"
IF
{{issue.Field A.fieldChange.fromString}} equals X
AND
{{issue.Field A.fieldChange.toString}} equals Y
THEN: Edit issue fields "Field B"
When I edit Field A from X to Y, I expect an action to be executed on Field B.
This action is not happening, when checking the audit log I am getting a "No actions performed" with a "The following issues did not match the condition:".
I do not understand where I am going wrong, though expect it to be something extremely obvious (yet not to me).
Anybody has any suggestions?
So what I settled on is :
{{#changelog.Field A}}{{fromString}}{{/changelog.Field A}} equals X
AND
{{#changelog.Field A}}{{toString}}{{/changelog.Field A}} equals Y
This is where the plot thickens, and I probably have not been asking the right questions.
Field A has 6 available value, all starting with a numerical value going from 1 to 6.
The difference between the first numeric value of X and Y needs to get added to the current value of Field B.
I think it should be possible to do in 1 line of code (big question mark), but I have clearly bitten off here more than I can chew. I think I understand the logic of how the line should look like, I just can not find out the correct syntax.
What I am thinking about is the following:
{#math}}
{{currentvalue.Field B}}
+
( {{oldvalue.Field A.charAt(0)}} - {{newvalue.Field A.charAt(0)}} )
{{/}}
Would it be possible at all to use old field values and character stripping in a math formula?
Sorry for whiteboarding here, but I found the solution
When the field value changes, first I create 2 new variables
{{oldvalue}} = {{#changelog.Field A}}{{fromString}}{{/changelog.Field A}}
{{newvalue}} = {{#changelog.Field A}}{{toString}}{{/changelog.Field A}}
Next I used a THEN component to edit Field B with the following:
{{#math}}{{issue.Field B}} + {{oldvalue.charAt(0)}} - {{newvalue.charAt(0)}}{{/}}
This does exactly what I need it to do, maybe there is a better way of doing it still, but for now this is sufficient.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
As per doco, @Michael Nassette
https://support.atlassian.com/cloud-automation/docs/jira-smart-values-issues/#--eventType--
The field change trigger exposes {{fieldChange}}variable, which would have the previous and new value for the field in trigger.
So, remove issue.FieldA part in your if condition, and it should work fine
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Or, at least I assume so, it should work...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Michael Nassette Could you try something like the following condition based on Smart values?
Advanced Compare condition
Field value = {{#changelog.Field A}}{{fromString}}{{/Field A}} equals X
Field value = {{#changelog.Field B}}{{toString}}{{/Field B}} equals Y
Hope this helps!
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.