How to add number of days stored in a custom field

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?


3 answers

0 votes
Nick Menere Community Champion Jul 24, 2017

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.




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'?

Nick Menere Community Champion Jul 25, 2017

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 -


The only work around is to use a text customfield as this wont convert the 2 to 2.0




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.


Suggest an answer

Log in or Sign up to answer
Community showcase
Published Mar 13, 2019 in Marketplace Apps

Marketplace Spotlight: Marketing apps for Confluence to keep your teams working on the same page


262 views 0 6
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you