Using Jira Cloud (premium) for an automation rule to update the card due date when the WorkDuration of the card changes.
WorkDuration is custom number field
Rule trigger is WorkDuration value changes. If WorkDuration is not empty, set Due date to the start date plus WorkDuration.
Audit log gives me the following, and Due date is set to None. What is missing in the smart value to set the Due date?? The rule results in setting due date to none.
Exact text for due date is: {{issue.start date.plusdays(WorkDuration).days}}
I'd rather have business days but using days because it's a shorter value.
Assuming your WorkDuration field smart value is correct, please try this one, fixing some case errors and removing the "days" from the end:
{{issue.Start date.plusDays(issue.WorkDuration)}}
If that does not help, please try this how-to article to learn the name, spacing, and case for the field's smart values (or their custom field ID values): https://support.atlassian.com/cloud-automation/docs/find-the-smart-value-for-a-field/
Kind regards,
Bill
THANK YOU!! It was "issue.WorkDuration" for the fix
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Is it possible to create a variable with the change in value of WorkDuration? I've tried various combinations to add create a variable after the If WorkDuration is not empty without success....
I can get to the WorkDuration field values in log actions where Previous duration is
{{fieldChange.fromString}} and current WorkDuration field is {{fieldChange.toString}}
I can't get the difference, of them to work so that a negative duration change can be applied to dependent cards. I've used a few variations of smart values to get the difference:
{{fieldChange.fromString.asNumber.diff(fieldChange.toString.asNumber)}} and
{{fieldChange.fromString.diff(fieldChange.toString)}} and
{{fieldChange.fromString.diff(fieldChange.toString).asNumber}}
All yield a null value in the audit log.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The diff() function is for date / time values.
Please try using a math expression with those changelog values: https://support.atlassian.com/cloud-automation/docs/jira-smart-values-math-expressions/
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I'm sorry for being so dense.... Is there a way to get the audit log to show what it's doing with a calculation?
Thank you for the direction to use a math expression! I was thinking this is logical comparison because the only way to get to the variable value was with 'String' in the smart value.
These give me a null answer in the audit log:
{{fieldChange.fromString.minus(fieldChange.toString)}}
I also used: {{#=}}{{fieldChange.fromString}} – {{fieldChange.toString}}{{/}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
No worries; we are all learning as we experiment with rule-writing.
You may use the Log action to write results to help with debugging, which I see you already have used in your rule. For example I recommend writing these to the log for your rule to observe what they contain:
WorkDuration from and to String: {{#changelog.WorkDuration}}from: {{fromString}} and to: {{toString}}{{/}}
As that appears to be a number field, you could also try this for the difference, assuming no null values:
WorkDuration difference: {{#=}}{{#changelog.WorkDuration}}{{to}} - {{from}}{{/}}{{/}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I plan on putting an IF statement back in to make sure WorkDuration field is not empty. Took it out until I can get the duration difference variable functioning.
I tried the WorkDuration difference formula and get a result of '-' in the audit log. From the log actions the math should be 1 - 2 which is -1, but the audit log is showing '-'. Is there a Jira limit that doesn't allow negative numbers?
Rule:
Audit Log:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hmmm...the "raw" field values of {{from}} and {{to}} appear not to be working for that field type...or they contain other metadata which prevents the math.
Let's use a math expression with the string values in the Create Variable action:
{{#=}}{{#changelog.WorkDuration}}{{toString}} - {{fromString}}{{/}}{{/}}
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.