Automation in fields
Asked by Barry Neilson:

Hi All,

I am working with Automation - Jira Cloud - Team managed

Script 1 worked once or twice. Then I created a second script to run.

**Script 1**

**When**: Issue is updated

**Then**: Edit Plan Days field (Number field)

**Script**: {{issue.Start Date.diff(issue.Plan End Date).days}}

**result**: Audit log says aborted.

**Script 2**

**When**: Issue is updated

**Then**: Edit Complete Days field (number field)

**Script**: {{#=}} {{issue.Plan Days}} \* {{issue.% Complete}} \* 100 {{/}}

**Result**: Completed Days does not populate. Rules Tab shows black circle with i.

What am I doing wrong?


Answers:
author: Duc Thang TRAN
body: Hello [@Barry Neilson](/t5/user/viewprofilepage/user-id/5564427)

Can you show me the audit log for these automations? And can you confirm that 'Start Date' and 'Plan End Date' are custom fields of type 'Date' and '% Complete' is of type 'Number'?

Best,


author: Trudy Claspill
body: Hello [@Barry Neilson](/t5/user/viewprofilepage/user-id/5564427)

A black circle with an "i" next to the rule name usually means you have put something into the Rule Details Description field, and if you hover over the "i" it will show you that information.

Can you provide screen images of the rules and the Audit Log information? Sometimes there are typos in the actual rule that don't get carried into the community post when you retype it.

I suspect that part of the problem is that you are trying to run two rules simultaneously against the same issue triggered by the same event, and one rule depends on the value of a field that is being change by the other rule.

Is there a reason that you are choosing not to combine the Edits into a single rule?

One execellent debugging technique for Automation Rules is the Log action.

<https://support.atlassian.com/cloud-automation/docs/jira-automation-actions/#Log-action>

This action prints information into the rule execution log. I use this action to print the original values of each field I want to change, and to print any calculations I'm doing or smart value references I use to set the value of fields. That can help tell you if the fields and smart values contain the values you expect.

You also must be precise with spacing and capitalization for field identification in smart values. The wrong spacing or capitalization can result in you referencing a different field than you intended. The Automation Rule will not necessarily tell you that it can't find the field you referenced. Instead is will just evaluate the value to be Null.

comments: author: Barry Neilson
body: Thanks Trudy

Thanks again for your help.

you said: A black circle with an "i" next to the rule name usually means. Thanks, good to know.

I check spelling, caps and everything.... Jira does not update very fast even when it does work. It's insanely slow. The audit log takes months to update.

But now all of the rules have failed. Every single \<insert favorite string of expletives here\> one of them.

**Update:**

.... aaaaaand I think I know what the problem is.

Monthly rule executions have been exceeded.

... and I've been sitting here like a dummy trying to work out that I've met the trial limits.


author: Trudy Claspill
body: Ah, yes, the rule execution limits.

With a trial the limit is quite low.

So, again another good tactic is to use the Log action to print out all the field values and calculations that you would use in your rule before adding any actions to change issues. A rule that has only Log actions does not count against your monthly usage. Refer to this documentation for more information on how rule usage is calculated.

<https://support.atlassian.com/cloud-automation/docs/how-is-my-usage-calculated/>


Tags: cloud

jira-cloud