Hi,
I would like to do the following:
Trigger:
Condition + action:
The "edit" part is just an example. The main question is how the if-else block should be created so that I can compare the due date and the start date. Because in the end I want to use the information how many days are in between due date and start date.
What is the best way to accomplish that?
Thanks a lot for any ideas!
Regards
Simon
Hello @Simon Huprich
How are you making changes to the fields? Are those changes being made inline in the Work Item View such that one field is changed and saved and then another field is changed and saved? Or do you use a workflow transition with a screen where you can choose to change one or the other or both?
Is the scenario to determine if both fields have been changed at the same time, or to find out when the Due date changes if there has ever been a change to Start date?
In what way is this rule not working for you? What is the output in the rule audit log when the rule executes?
A problem I see with your rule is that the trigger is monitoring only the Due date. Because of that the {{fieldChange}} smart value will contain information only about the change to the Due date field. So your condition to check the smart values of {{fieldChange.startdate.*}} are likely getting no values.
When I better understand your scenario I might be able to offer some advice.
Let me explain my idea in other terms:
Trigger: the due date of an work item is changed manually in the LIST view.
Condition: After this change the automation rules should compare the start date (already exists as date in the work item) and the changed due date. This comparison can have different results. Start date and due date could have the same date. Or start date and due date could be different (+1 day, +2 days, +3 days, etc. up to +9 days). The rules should then recognize this number of days and should create an action.
Action 1: If start date is 01.01.2026 and due date ist 02.01.2026, then there are 2 days in difference. If the result is 2 days then a specific value should be added to another custom field of this work item
From my perspective the Action is not the issue but the Condition could be.
Thoughts?
Thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you for that additional information.
First you should remove the Condition that you have added within the rule Trigger. That is meaningless. {{fieldChanged.startdate}} is not a valid smart value in this case.
Do you have something set up elsewhere to ensure that the Due date is never set earlier than the Start date? If not, what would you want to have happen in that case?
What would you want to have happen if the Due date has changed from having a value to having no value?
What would you want to have happen if the Start date has no value?
Some changes I would make to the rule are:
1. Add a condition after the trigger to confirm that the Due date field has a value.
2. Add a condition after the trigger to confirm that the Start date field has a value.
3. Add a Create Variable action and store the calculation of the difference between the dates in that variable and initialize it to 0 (no difference in dates)
4. Then I would set up an If/Else block to check if the dates are the same and set the same variable to 0 if so, otherwise set the variable to the difference between the dates.
5. Then I would set up an If/Else-if block to check the value of the variable and take the appropriate actions.
Side note:
You said:
If start date is 01.01.2026 and due date ist 02.01.2026, then there are 2 days in difference.
That is not correct. The difference between Jan. 1 and Feb. 1 is 31 days.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Simon Huprich , based on what I read here I would start with something like this where you create and store the difference between your two dates and then use if/else clause to use actions.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Jack Brickey
I already tried something similar, but it didn't work.
I wanted to integrate the comparison directly into a condition.
Any thoughts?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can certainly do it without the variable. I just find using variables to be cleaner. If I need to change the smartvalue it is a onetime change vs. changing each if/else. I do not grasp the condition in your trigger. I think @Trudy Claspill hit on that very issue. You need to pull that out and create any unique conditions immediately following the trigger before any if/else.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.