The businessAdd filter adds a specific number of days to a date, skipping non-business days, where non-business days mean Saturday and Sunday. This article provides the code snippet to add a given number of days to date while skipping the specified weekdays.
Instructions
Navigate to the intended workflow to make the necessary changes in the edit mode.
Select the required transition.
Select the Post functions tab and click
Add post function
.Select the Set issue fields (JMWE app) post-function and click
Add
.Select the target issue and target field in Target Issue(s) and Add Field(s) respectively, and add the following template as Value for the added field:
Code Block language java {% set startDate = issue.fields.customfield_10057 %} {% set nod = issue.fields.customfield_10055 %} {%set endDate = startDate %} {% for n in range(0, nod) %} {%set endDate = endDate | date('add' , 1 , 'days') | date %} {% set day = endDate | date('e') %} {% if day == 5 %} {%set endDate = endDate | date('add' , 2 , 'days') | date %} {% elif day == 6 %} {%set endDate = endDate | date('add' , 1 , 'days') | date %} {% endif %} {% endfor %} {{endDate}}
...
Publish the workflow to see the changes reflected on the target issue.
References
...