Our new Appfire Documentation Space is now live!

Take a look here! If you have any questions please email support@appfire.com

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Next »

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 by skipping the specified weekdays.

Instructions

  1. Navigate to the desired workflow transition and add the “Set issue fields (JMWE app)” post-function.

  2. Select the target issue, target field and add the below template in Value :

    {% 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}}

Replace :

  • 10057 with the id of the date field to which the number of days should be added.

  • 10055 with the id of the field, which contains the value of the number of days to be added.

In the above template, we’re considering Friday (line #7) and Saturday (line #9) as non-working days. Modify them as per your use case (refer to this page)

References

 

  • No labels