I have a workflow with a frequency custom field (a number field) which records the number of months before the next task is due.
I want to use it to update the duedate field so
duedate = current due date plus F months
I thought this would work,
{
"fields": {
"duedate": {{issue.duedate.plusmonths({{issue.frequency}})}}
}
}
but I get an error
Error while rendering additional fields.
Failed to get value for issue.duedate.plusmonths({{issue.frequency
So it seems you can't embed smart values.
Any other ideas?
UPDATE:
I can do it with if/else blocks, but that means I need to change the logic every time I want a different frequency.
I have similar issue. on the trigger of issue.fields.timeestimate value change, I want to adjust the issue.Target end by adding issue.Target start and issue.fields.timeestimate.
I tried many combination. If i use the now, it works, but as soon as i use issue.target start instread of now, it fails.
This works
{
"fields": {
"Target end":"{{#now}}func=plusSeconds({{issue.fields.timeestimate}}).toBusinessDay(){{/}}"
}
}
Is there any way to change a date field by adding two variable???
Thanks
Hi @Benoit
Please create a new question for topics like this. That will help others in the community see it sooner and make solutions easier to find/search for. Thanks!
Regarding your question, have you tried to first compute the value and put it in a Create Variable smart value? You could then set that value to Target End.
Best regards,
Bill
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for that information about your platform. Note that when you create a new question the community can see what platform you are using, and so help with relevant ideas.
Your example JSON does not seem to match your request. Have you tried something like the following:
{{issue.Target Start.plusDays( issue.fields.timeestimate.toDays() ).toBusinessDay()}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
First tanks for your support. But I am still struggling with this rules. There is no documentation I can refer. Another why your help is much appreciated. This is what I have so far:
{
"fields": {
"Target end":"{{issue.Target start.plusDays(issue.fields.timeestimate.toDays() ).toBusinessDay()}}"
}
}
Gives me an error: Error editing issuesTEST-1203 (Error parsing date string: (customfield_10207))
Where TEST-1203 is the edited task at fields.timeestimate
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Here is a link to the documentation for the server version of automation:
https://confluence.atlassian.com/automation/smart-values-993924860.html
Next, the error seems to indicate a problem with customfield_10207, so let's try to break this problem into pieces to see what is happening...
Using this method of progressively adding pieces to the audit log helps me diagnose what part of the automation syntax has the problem.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It is the conversion that is not working.
The issue.fields.timeestimate is in second. if I could just divide it by 28800 everything is fine, but even a simple division is not working.
"Target end":"{{issue.Target start.plusDays(144000/28800).toBusinessDay()}}"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Gotcha... Here is the documentation on the math functions:
https://confluence.atlassian.com/automation/working-with-numbers-993924632.html
Please try this for the conversion:
{{#=}}{{issue.fields.timeestimate}} / 28800 {{/}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I have one finding, the issue.fields.timeestimate is in minutes in a working day. 480min/8h
This can be good to know...
But I tried what you suggest, but it can't be added inside the bracket'()'.
The things is that Advanced roadmap is not moving dates automatically. I am trying to achieve that with automation. so I just need to add the issue.fields.timeestimate with the target start to the Target end. prety basic, but i cannot do it. looks like the NOW is working, but not with any other field. I spent more than 3 days full time on that. I start to see {{smartvalues}} everywhere.
Documentation is very deficient for advanced stuff.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for that additional information. And, I agree that the documentation could be improved...definitely for more advanced usage cases.
There are two work-arounds for performing that math operation:
Pausing on further changes, if you believe there is something broken with the Advanced Roadmap updating, I suggest submitting a ticket to Atlassian support to ask what they think: https://support.atlassian.com/contact/
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Other finding... Target end and Target start are not date field. Therefore, date fonction wont work. They are string... Is it possible to confirm that?
I'll try a new way by converting the string to date and then do date function to add days, minutes or even seconds. Why is date in advance roadmap are not date field, but text field????
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Other finding, Server Version do not allow .divide neither .multiply as a function.
Atlassian sucks honestly. I know they want to push for Cloud, but some company just can't go cloud and cannot afford datacenter. Just a huge amount of frustration. We decided to move to Jira just before the announcement. We would do it if we knew it.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
as for now, I have one workaround: Create another custom field that are in days instead of seconds {{Estimation en jours}}. then use this formula:
{
"fields": {
"Target end":"{{issue.Target start.toDate("yyyy-MM-dd").plusBusinessDays(Estimation en jours)}}"
}
}
5 days of my life lost because of the lack of documentation from Atlassian and of course the lack of support for the server version. more over, having a date field recorded as a text in the database {{Target start}} and {{Target end}} that require to be converted.
One word resume it:
FRUSTRATED!!!!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Andrew Syme
Did you try removing the inner set of braces?
{{issue.duedate.plusmonths(issue.frequency}}}
Best regards,
Bill
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes. It's not valid
Error while parsing additional fields. Not valid JSON.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi, and apologies, @Andrew Syme ... There does not appear to be a way to nest the values yet. Here is the Code Barrel (now part of Atlassian) ticket for them to work on it:
Although as you noted it is possible by editing the rule, not directly using your custom field. Maybe workflow and add-on script handlers can do it, if you have one.
How about this as a work-around: how many values are there for your custom field, Frequency?
If there are a limited number of values, you could use a create issue trigger (and/or edit to frequency) and use your if-if/else... structure to set the value.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Bill, as per my update I've used If else blocks as there are only 3 frequencies at the moment but I would definitely want to have nested smart values to allow for various frequencies without having to keep the if/else blocks in sync.
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.