I created a Jira rule that triggers when a customer date field gets changed.
Once triggered, I'm trying to edit another customer date field using the value of the changed field and adding 3 business days to it.
For that field to modify, I used smart values, I entered this in the Edit work item- field section:
{{triggerIssue.customfield_10126.toDate.plusDays(3).toBusinessDay()}}
...but the field doesn't update.
Any ideas? Should I be using triggerIssue?
Thanks
Hi @Matt Brescia -- Welcome to the Atlassian Community!
When date or date / time-picker fields are used as a smart value, they can implicitly return a date / time value...even when they are only for a date-picker. (For date only, the time returned is the start of the day.)
One workaround for this is to force the value to only return the date part as text using the jiraDate format and then allow Jira to automagically convert back to the correct type:
{{issue.customfield_12345.jiraDate}}
Kind regards,
Bill
Hello @Matt Brescia
Welcome to the Atlassian community.
Please show us the entire rule and the details of each step. We need that information to help you debug the problem.
I also recommend that you use the Log action to print into the rule execution log each smart value you are trying to use, immediately before you use it; i.e.
{{triggerIssue.customfield_10126}}
{{triggerIssue.customfield_10126.toDate}}
{{triggerIssue.customfield_10126.toDate.plusDays(3)}}
{{triggerIssue.customfield_10126.toDate.plusDays(3).toBusinessDay()}}
If there is something wrong with the references, logging the values one step at a time will help reveal that.
What type of field is customfield_10126? If it is a Date or Date/Time field then you don't need the "toDate" function.
As per the documentation, you also don't need parentheses after toBusinessDay
And what type of field is the one you are attempting to set?
Please also show us the full details from the rule execution audit log from an instance when the rule has been triggered. Make sure to click all the ">" characters at the end of the log message to expand all the details.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for your response. Here is more info around the steps.
The Trigger is successful.
Here is the Edit Work Item Fields. For this test, I shortened the expression to just {{triggerIssue.customfield_10126}}. It's still not working :
Both the field I'm trying to update and the field I'm using for the update are Date Picker fields (not date and time).
I get a success message in the log even though the update doesn't happen.
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 the additional information.
Can you add a Log action to your rule and in it but the exact same smart value you have in your edit action. That will print the field value in the rule audit log.
It may be that you are not referring to the correct field with that smart value. How did you determine that you should use "customfield_10126"? What is the displayed name of that field?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi, I added a log action and was able to see the correct value. I didn't know you could create log actions so that is very helpful.
I don't know why, but the rule is working now. The only change I made was adding the log action.
Oh well, thanks for your help.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sometimes there is a timing issue. Adding another action slows down the rule processing for a fraction of a second. Alternately you can insert a Re-fetch Data action after the trigger to make sure the rule gets the fully updated work item before continuing.
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.