I need to calculate how many days it was since the risk became actualized Issue.
when Risk becomes the Issue, we set the date "Issue Date"
I need to calculate the number of days between that date and today - and record it in "Days in" scripted field.
I tried to use Edit Issue action and set this field using this script:
{
"fields": {
"Days in": { "value": {{issue.customfield_10803.diff(issue.customfield_10820).days}}
}
}
No bueno! what am I doing wrong?
Made following changes:
Result looks like this:
Checking "successful" issues - still empty customfield_10821 (which is a NUMBER field).
(Thank you for your help, Florian)
Hi @Lana Decker
Would you please post images of your complete rule and the audit log details showing the rule execution? Those may provide some context for what you are observing, and give the community ideas on what to suggest. Thanks!
Until we see that...
This could be a scoping problem, based on where you are performing that date diff() in the rule. It could also be a timing problem, if the issue you are using was just created.
Kind regards,
Bill
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I posted a few - answering questions from Florian, making changes per his suggestions.
To address your points:
This could be a scoping problem, based on where you are performing that date diff() in the rule. - I am trying to set a number field from EDIT action , triggered on schedule (see screenshots).
It could also be a timing problem, if the issue you are using was just created. - no, most tickets are over a week old or older, only one is new.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Lana Decker
Have you try to use the smart value below ?
{{now.diff(issue.created).days}}
Do not use the advancedediting but select the filed in the list and populate the field with the value above.
Reagrds
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you for your suggestion!
Days in is a scripted field type and its not selectable - so I created another field (number type)
Using {{now.diff(issueID=10821).days}} - I would expect to get number between date field 10821 and today in days - but get no errors, no result
Using {{now.diff(issue.created
).days}} - I would expect to get number between that date and today in days - but get no errors, no result.
Automation says success, but the field is empty.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
{{now.diff(issueID=10821).days}} is not valid you should use
{{now.diff(issue.customfield_10821).days}}
When you say no result, is that there is nothing displayed or the field is empty when you try to edit it ? Is the field on the view screen ?
Regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Field is on all screens (or a single screen we use for create, edit and view).
I edited query per your suggestion and get this when rule is triggered manually:
Checking any of the "successfully edited" issues i see that field is null in all of them.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I would say that the field with id 10821 do not have context for the porject you are trying to apply the automation on.
Can you share the automation definition as well ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If it didn't exist I would not be able to set it manually - but I can (also it wouldn't appear on the screen in the first place).
Rule scope is All projects.
I tried to run it as me (god admin) and service god admin account with same result.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Can you add an action "Log action" before the edit and copy paste what you have in the Days as Issue, {{now...... ?
So you will be able to see in the audit log of the value return by the smartvalue to see if it's what is expected.
What is the type of the field with id 10821 ?
Also you can update the JQL with something like Key = ISSUe_KEY in the test phase to try it on 1 issue instead of 500 or more.
Regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
result:
Checking "successful" issues - still empty customfield_10821 (which is a NUMBER field).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Targeting specific issue:
issue history , activity has no changes - and field is still empty, but editable manually.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Lana Decker,
This is quite unusual, as I can't see anything wrong with your rule.
Tried replicating something similar, whereby I have a schedule rule which uses JQL to search for a single issue, I then Log out {{now.diff(issue.created).days}} and as you can see, get the desired value of -63.
Would you mind reaching out to the Atlassian support team https://getsupport.atlassian.com/ ? They can look at your instance and understand what's going wrong.
Thanks !
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.