I want to calculate a date in the advanced section of a clone action. This is what I have now:
{
"fields": {
"parent": { "key":"{{triggerIssue.key}}" },
"assignee": { "name": "{{initiator.key}}" },
"description": "{{issue.fields.description}}",
"duedate": "{{#triggerIssue.fields.ETD}}func=plusDays({{issue.fields.customfield_10510}}),format=\"jiraDateTime\"{{/triggerIssue.fields.ETD}}"
}
}
The Due Date of the cloned issue should be calculated based on the date field ETD of the issue which triggered the rule and a number of days stored in the numeric customfield with id 10510 of another issue which is found based on a JQL related issue search. I am sure the issue object is right because the description is cloned ok.
Can anyone tell me if this is possible and if so what should be the right syntax to use here?
I already tried to use a text field for the custom field but still it seems that a variable in the plusDays function is not resolved.
Thanks Nick for your answer.
I added some log statements and did some further testing. It seems that the value for customfield_10510 (Resolution Period) resolves to '2.0' and that this value is not accepted by the plusDays function. This functions expects '2'.
Is there a way to transfer the numeric value of '2.0' to '2'?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am assuming this field is a Number Csutomfield.
I've had a play around with this and can't figure out a way to do this. I've raised a bug at - https://codebarrel.atlassian.net/browse/AUT-447
The only work around is to use a text customfield as this wont convert the 2 to 2.0
Cheers,
Nick
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey Retmer,
Thanks for trying out Automation for JIRA.
This can definitely be done.
I usually find in the situations when I am trying to debug I use the "Log action" to print out the relivent info.
E.g. I'd use this as a value in the Log field:
{{triggerIssue.fields.ETD}} - {{issue.fields.customfield_10510}} - {{#triggerIssue.fields.ETD}}func=plusDays({{issue.fields.customfield_10510}}),format=\"jiraDateTime\"{{/triggerIssue.fields.ETD}}
This print out all the different parts to make sure that we know where it is failing.
I'm guessing that the format is wrong. Duedate does not use time so you can try the format "jiraDate".
Though if ETD is a just a date (no time) you should be able to leave off the format all together.
Also, I'd recommend changing the customfield_10510 to the name of the customfield as it is easier to understand.
Another recommendation would be to use the actual fields from the field selector and copy values where possble. You should be do all of these fields in there.
Let me know if you still are having trouble and paste teh output from that Log action.
Cheers,
Nick
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.