Recently I got a request to provide a function to classify a team (customer specific date effective classification). The goal was to make the process simple and user friendly. My suggested solution was accepted. I want to share it, so probably it can be re-used.
Problem description
Several classifications are defined. Only one classification can be assigned to a team at any given time. The current classification is presented in Teams form. If current classification is not defined then Classification field is empty. The user can simply set new classification by selecting a new value in lookup. If new classification is set, previous classification is made ineffective. Future classification is taken into consideration for new classification validity period. The user can manually update classifications effective dates in Party form.
Steps to reproduce
1. Define classifications
To simplify it - let's assume that "Class1", "Class2", "Class3" are defined
2. Add "Class1" in Party form for new "Team 1"
Effective (ValidFrom) set equal to (today - 7 days), Expiration (ValidTo) left without changes.
3. Add "Class3" as future period in Party form for the "Team 1"
Effective (ValidFrom) is equal to (today + 7 days), Expiration (ValidTo) left without changes. Click Yes in dialog and note that Expiration (ValidTo) is updated on "Class1"
4. Open "Team 1" and make sure that current classification is "Class1"
5. Set current classification to "Class2" for "Team 1"
4. Three classifications are defined in Party form
"Class1" valid from (today - 7 days) to (today - 1 day)
"Class2" valid from (today) to (today + 6 days)
"Class3" valid from (today + 7 days) to (max date)
Hints
Write down all possible periods to design the algorithm.