Send email post function date_time functions not properly working

Issue #533 resolved
NickA created an issue

I have been using the Send Email post function for quite some time now, but haven't experimented much with the calculations that it allows you to do. I'm trying to send an email and at the end I want it display the current date and time + 5 business days.

In the examples you provide, there's an example that does just this, but it's not working as expected. The function is as follows: addDaysSkippingWeekends(%{00057}, 5, LOCAL) where %{00057} is the current date and time.

When the email triggers it sends fine, but it displays like this: addDaysSkippingWeekends(06/Mar/17 3:13 PM, 5, LOCAL)

Any help is greatly appreciated. It's probably just something small I'm missing, but I'm not sure what it could be since I'm using the example that was used in the post function.

Comments (4)

  1. Fidel Castro Armario repo owner

    Hi Nick,

    You have to do that calculation in a previous Copy a parsed text to a field post-function, storing the value into "Ephemeral string 1", and then use that field in "Send an email post-function.

    To do it use Copy a parsed text to a field with the following configuration:

    • Target field: Ephemeral string 1
    • Parsing mode: advanced
    • Text to be parsed:
    dateToString(addDaysSkippingWeekends({00057}, 5, LOCAL), LOCAL, SERVER_LANG)
    

    or if you wish to include the time part:

    dateTimeToString(addDaysSkippingWeekends({00057}, 5, LOCAL), LOCAL, SERVER_LANG)
    
  2. Fidel Castro Armario repo owner

    Hi @abdoon,

    Since version 2.2.39, JIRA Workflow Toolbox supports Custom Schedules, and you can do all you are doing now using addTimeSkippingWeekends () and subtractDatesSkippingWeekends () functions, and much much more.

    I recommend you to take a look at it. You will be able to do amazing things using it.

  3. Log in to comment