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!