Calculate Due Date
I'm trying to create a rule that when a issue is created, the field "Due Date" is automatically filled with D+2 (two days from the current date).
Example: If I create a issue now (13/apr/2016), the Due Date field must be filled with 15/apr/2016.
So I edited the workflow and added a "Post Function" on the first create flow with the following rule: addDaysSkippingWeekends(%{00057}, 2, LOCAL)
It's not working.
Can you help me please?
Comments (9)
-
repo owner -
reporter Hi Fidel. Thanks for your answer, but the problem persists.
See the images please:
-
repo owner Jonas, for doing time calculations you should use "Mathematical and date-time expression calculator" post-funcion, but you are using "Copy parsed text to a field post-function".
-
reporter Thanks a lot... My mistake. Thanks.
-
reporter - changed status to resolved
-
Hi, Fidel,
I want to use the above provided solution but with some more logic. I want to have 3 separate results based on a custom field.
So for example; if "custom field = A" do this > "addDaysSkippingWeekends({00057}, 3, LOCAL)" or if "custom field = B" do this > "addDaysSkippingWeekends({00057}, 6, LOCAL)" or if "custom field = C" do this > "addDaysSkippingWeekends({00057}, 9, LOCAL)".
How would I do it in one post function?
-
repo owner Hi @mosheeh,
You can use "Set a field as a function of other fields" post-function with the following configuration:
In the example T1 is the field whose value can be A, B or C.
Setting rules are:
(A)addDaysSkippingWeekends({00057}, 3, LOCAL) (B)addDaysSkippingWeekends({00057}, 6, LOCAL) (C)addDaysSkippingWeekends({00057}, 9, LOCAL)
-
Thanks Fidel
-
repo owner Hi @mosheeh,
Since version 2.2.39, JIRA Workflow Toolbox supports Custom Schedules, and you can do all you are doing now using
addTimeSkippingWeekends ()
andsubtractDatesSkippingWeekends ()
functions, and much much more.I recommend you to take a look at it. You will be able to do amazing things using it.
- Log in to comment
Hi Jonas,
You should use "Mathematical and date-time expression calculator" post-function with the following expression:
The problem is that you are using %{00057}, which returns a string value representing current date and time, but you should use {00057}, which returns the numeric value for current date and time, i.e., the number of milliseconds elapsed since January 1, 1970, 00:00:00 GMT.