I define a rule to auto log work when user change effort value.
Step 1: Calculate the diffday difference when the developer actual effort field (customfield_19616) changes by subtracting the old value (stored in the customfield_10303 field.because fieldchange.from.value cannot be used). The unit of this field is days.
smart values:
{{#=}}{{issue.fields.customfield_19616.diff(issue.fields.customfield_10303).abs}}{{/}}
Step 2: Convert diffday to hours and store it in the log work field.
smart values: {{#=}}{{diffday}} * 8{{/}}h
Step 3: Store the value of the developer actual effort field in the program_id field to calculate the difference next time.
Smart Value:
{{issue.fields.customfield_19616}}
I try many way but seem it not work. This log show bellow
I'm using Jira v9.12.10
Please help me
Hello @toannv26
Can you try this smart value if you need diff business days ?
{{#=}}{{issue.fields.customfield_11206.diff(issue.fields.customfield_11256).businessDays.abs}}*8{{/}}
If only need diff day
{{#=}}{{issue.fields.customfield_11206.diff(issue.fields.customfield_11256).days.abs}}*8{{/}}
Hope this can help
Hello @toannv26
Welcome to the Atlassian community.
I suspect there may be a problem with your use of the diff function in the math expression you use when creating your {{diffday}} variable.
Can you add a Log action after creation of that variable to log the value of it?
I suspect this is the case because no value is being shown for the variable in the error message in your log. Instead it is detecting the "*" as the first character in that match expression.
I think instead of the diff function you need to use the unary minus operator to subtract one value from the other.
Disclaimer: I don't have a Data Center environment where I can test this out, so this is an untested recommendation.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Trudy Claspill Thank you for your support. I think you are right about diff value issue. I change to minus operator but it still not working
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What are the custom fields types for 19616 and 10303?
Consider logging the values of those fields, and the math expression from your Create Variable, into the audit log to see if you are getting the expected values
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Trudy Claspill
customfield_19616 type float, customfield_10303 type text
I try to convert text tonumber but not working
{{#=}}{{issue.fields.customfield_19616 - issue.fields.customfield_10303.asNumber}}{{/}}
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.