Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Change log comparison on custom field

Ryan Anderson April 6, 2018

I have a custom field named "blah" which is a number field. I am trying to use this jql condition to trigger an action:

{{#changelog.blah}}{{fromString}}{{/}} > 1 and {{#changelog.blah}}{{toString}}{{/}} > {{#changelog.blah}}{{fromString}}{{/}}

I keep getting an error which says:

"No subsequent actions were performed since JQL condition did not pass due to error running JQL:Error in the JQL Query: Expecting a field name but got '>'. You must surround '>' in quotation marks to use it as a field name. (line 1, character 26)"

I've also attempted to setup a compare condition:

  • First value: {{#changelog.blah}}{{toString}}{{/}}
  • Condition: Does not equal
  • Second value: {{#changelog.blah}}{{fromString}}{{/}}

I get a success message saying: "The following issues did not match the condition" even though the value in field "blah" was updated and does not match what it was previous to this compare being run.

NOTE: I am running this at the end of a rule where field "blah" is incremented. I am refreshing the issue after the increment occurs and before I execute the above conditions.

I know I'm doing something wrong, I just don't know what. The only add-on I have installed on my cloud instance of Jira is Automation for Jira and I'd like to keep it that way. Thanks in advance for your help.

1 answer

1 vote
Nick Menere
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 7, 2018

Hi Ryan,

 

The problem with the JQL Condition is that it doesn't evaluate to a valid JQL query. E.g. The above would resolve to something like"

3 > 1 and 2 > 3

This would run in Jira advanced search as it is invalid JQL .

In order to do this you will need to use a compare condition with the following:

{{#=}}{{#debug}}{{#changelog.Numbers}}{{fromString}} > 1 && {{toString}} > {{fromString}}{{/}}{{/}}{{/}}

Then select "Equals" and then put "1" into the second field.

I've surrounded the whole thing in a "debug" so that the rendered value will be put into this Audit log so you can what is being rendered.

You will need  to watch out for empty values and may want to put a condition before this to filter out these changes.

 

If you can't get this working, attach a screenshot of the config and also the results of the audit log.

 

Cheers,

Nick [Code Barrel]

Co-Founder

Ryan Anderson May 15, 2018

Sorry to respond so late to this, Nick. I have spent some time attempting to get this to work. I now understand the compare function a lot better than when I originally posted this inquiry. Thanks so much for your help.

However, I'm still unable to get this to work. The debug message comes back blank every time this rule is executed which doesn't make sense to me as it should be a 1 or a 0 if I understand correctly.

123.png

Nick Menere
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 16, 2018

Hey Ryan,

 

Chances are that the {{changelog.Numbers}} value is not rendering. It could be that Numbers was not included in the Transition.

Can you add a Log action with the following values:

Issue Value: {{issue.Numbers}} From: {{changelog.Numbers.fromString}} To: {{changelog.Numbers.toString}}

That should tell us if it contains the required values.

 

Cheers,

Nick

Nick Menere
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 16, 2018

Also, are you trying to get the pre/post values of Numbers from the edit above?

The changelog wont contain these, but rather the values changed during the transition.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events