Transcript:
0:00 [Music]
0:04 hi
0:05 everyone this is patrick from north52
0:08 North52 is a business rules engine for
0:10 dynamics 365.
0:12 in this video i'm going to take you
0:14 through a solution we designed for
0:15 customers complex case prioritization
0:18 rules
0:19 the cases are created from an external
0:21 system and if certain fields are
0:23 populated we then need to apply
0:24 different business rules
0:26 the customer wanted to prioritize the
0:28 cases based on three custom fields from
0:30 an external system
0:32 priority a 10-day counter priority b
0:34 90-day counter
0:36 and dispute amount there could be
0:38 thousands of cases involved
0:40 and each time a new case is created its
0:42 priority needs to be determined compared
0:43 to all the other existing cases
0:46 therefore we cannot simply recalculate
0:48 all priorities for each case
0:50 every time a new case is created as that
0:52 would result in updating thousands of
0:53 cases
0:54 each time a new case is created that may
0:57 result in significant
0:58 performance issues the priorities are
1:00 broken down into three rules
1:02 if priority a 10-day counter field
1:04 contains data
1:06 then those cases have the highest
1:07 priority if the priority being 90-day
1:10 counter contains data and the value is
1:11 less than 50
1:13 then these cases are the medium priority
1:15 finally
1:16 if the value in the priority being 90
1:18 day counter is greater than 50
1:20 these cases have the lowest priority for
1:22 each rule
1:23 the following sub rules apply we should
1:25 rank cases based on the number in the
1:27 priority a
1:28 or priority b counter fields where the
1:30 lower the value the greater the priority
1:33 if multiple cases exist for the same
1:35 number of days we prioritize based on
1:37 the highest dispute amount
1:38 and if multiple cases exist for the same
1:40 number of days and dispute amount
1:42 your priority is based on the earliest
1:44 case creation date
1:47 the higher the value in the case
1:49 priority field the more important the
1:51 case is
1:52 rule 1 cases will be assigned a priority
1:54 between two and three
1:56 rule two cases will be assigned a
1:57 priority between one and two
1:59 and rule three cases will be assigned a
2:01 value between zero and
2:02 one each time a new case is created we
2:05 will determine the rules to be applied
2:07 then identify the cases either side of
2:09 this case
2:10 add their priorities together and divide
2:12 by 2 giving us the priority for the new
2:14 case
2:16 this worked example will give us a
2:17 demonstration the maximum value for a
2:20 rule 1 case is three the minimum is two
2:24 when the first rule one case is created
2:26 case one we take the maximum and minimum
2:28 allowed values three plus two
2:30 and divide by two giving us a rating of
2:32 two point five
2:33 case two has a lower priority so we add
2:36 the minimum allowed value to the rating
2:38 for the previous minimum case
2:40 2 and 2.5 then we divide that by 2
2:43 giving us a rating of 2.25
2:46 case 3 has a lower priority than case 1
2:49 but a higher priority than case two
2:51 so we add 2.5 and 2.25 together and
2:54 divide by 2
2:55 giving us a priority value of 2.375
2:59 case 4 has a higher priority than all
3:01 previously existing rule 1 cases
3:03 so 2.5 the previous highest priority
3:06 rule 1 case rating
3:08 and 3 are added together and then
3:09 divided by 2 giving us a rating of 2.75
3:14 this way as each case is created it is
3:17 inserted into the priority queue
3:19 at the correct position without
3:21 requiring any updates to further cases
3:24 this is the formula we use for the case
3:26 prioritization
3:28 it is triggered from the cases created
3:30 by the priority a
3:31 priority b or dispute amounts are
3:33 updated
3:35 this sheet makes sure that the formula
3:37 only affects the cases we wanted to
3:39 the formula will proceed if either
3:41 priority a or priority b
3:43 fields and the dispute amount contain
3:44 data
3:46 next we set the maximum and minimum
3:48 range for the rules
3:50 then we decide which rule needs to be
3:52 applied to the case
3:54 if priority a 10-day counter contains
3:56 data then we use rule 1
3:58 otherwise if priority b 90-day counter
4:01 contains data
4:02 and the value is less than or equal to
4:04 50 we use rule 2
4:05 otherwise we use rule 3. once we have
4:09 determined the rule to use
4:11 we retrieve all the active cases
4:12 affected by that rule
4:14 and set out the minimum and maximum
4:16 priorities for the calculations
4:18 we count the number of cases retrieved
4:20 if there is only one case
4:21 then it is this case and its index
4:24 position is zero
4:25 the first position if we have more than
4:28 one case
4:29 we need to do some work so here we will
4:31 load all the cases into memory
4:34 add an incremental index field then get
4:37 the index of our case
4:40 next we begin to calculate the priority
4:43 if we have only one case
4:44 then our rating will be half the maximum
4:46 and minimum priorities
4:49 if we have more than one case but our
4:51 case is at a first position
4:53 we add the maximum priority to the
4:55 priority of the second highest case and
4:57 divide by two
5:00 if we have more than one case and our
5:01 case is in the last position
5:03 we add the minimum priority to the
5:05 priority of the second lowest case
5:07 and divide by two finally the most
5:09 common scenario would be where the case
5:11 is somewhere in the middle of the pack
5:13 so we add the priorities of the cases on
5:15 either side of the current case and
5:16 divide by two
5:19 lastly we update our case with the newly
5:21 calculated priority
5:24 here you can see some examples of the
5:26 formula in action
5:27 the lower the value in the priority a
5:29 10-day counter
5:30 the higher the priority you can also see
5:33 two cases with the same value in the
5:35 priority a
5:36 field so the case with the highest
5:38 dispute amount has the priority
5:41 thank you for watching and as always if
5:43 you have any questions about North52
5:45 please contact support north52.com or
5:48 visit support.north52.com
