Problem
I needed to automatically set the Due Date field in Jira Service Management based on a custom text field that contains values like "1d", "5d", etc. The automation kept failing with "Fields ignored: Due date (duedate)" or setting the date to null.
Solution
Action 1: Create Variable
- Variable name: daysToAdd
- Smart value: {{issue.customfield_XXXXX}}
- Replace customfield_XXXXX with your actual field ID
Action 2: Edit Work Item
- Due date: {{now.plusBusinessDays(daysToAdd.asNumber)}}
Create Variable first - Direct field reference in plusBusinessDays() doesn't work
❌ {{now.plusBusinessDays(issue.customfield_XXXXX.asNumber)}} - Direct field reference fails
Use .asNumber - Variables are stored as strings, must convert to number
(In this case 1d converted into '1.0' when testing output in comments)'
Hope this helps others struggling with the same issue!
Hi @Zeroocool ,
There's a know bug related to this: AUTO-957: {{[date].plus[Unit]([number])}} smart value doesn't recognize variables in Automation
You could check the workaround section and the comments area for some additional insights on the topic. 👀
*btw, I've moved this question to JSM app forum group
Cheers,
Tobi
Hello @Zeroocool
Please see here:
https://support.atlassian.com/cloud-automation/docs/jira-smart-values-math-expressions/
You can set the variable with surrounding {{#=}} and ending {{/}} - it tells the system to consider this as numbers.
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.