(this post was contributed by Brian Barnett, Senior Software Engineer on the MDS Team)
Up until this point we have been laying the foundation for enabling the human workflow. Along the way ( Part 1 , Part 2 , and Part 3 ) you’ve been exposed to other features within MDS. Now, we are going to be creating the business rules that drive the human workflow. See Part 1 to review the workflow.
*Note - This post references some features that are forthcoming in the RTM release of MDS and not available in the CTPs. It gives you an early look at what is coming to help plan for workflow scenarios such as this.
Here is what you will be learning:
Here are the business rules we will need to add. Priority comes into play and is very important. It determines the order the rules are run. The rules will be processed in order beginning with the lowest value. The sample Product model comes with several business rules (check those out too) and the first sample rule has a priority of 10 so I decided to give the “New Product” rule below a priority of 5 so it runs first.
Notifications are sent when validation rules are broken. That is why we are setting the ProductStatus attribute to not valid below, to create a validation issue.
Priority |
Name |
Description |
Rule |
Notification (group) |
5 |
New Product |
After a product is entered default its status to New. |
IF None THEN ProductStatus defaults to New |
|
50 |
New Bike Product |
Notify the Bike Inventory Dept that a new bike has been entered so they can add the cost information. |
IF DBA.ProductSubCategory.ProductCategory is equal to 1 AND ProductStatus is equal to New THEN ProductStatus is not valid |
MDS Bikes Inventory Dept |
60 |
New Accessory Product |
Notify the Accessory Inventory Dept that a new accessory has been entered so they can add the cost information. |
IF DBA.ProductSubCategory.ProductCategory is equal to 4 AND ProductStatus is equal to New THEN ProductStatus is not valid |
MDS Accessories Inventory Dept |
70 |
Costs changes need review |
If any of the three costs attributes that we added to change tracking group 1 are changed then set the product’s status to ReviewCost. |
IF has changed in group 1 THEN ProductStatus equals ReviewCost |
|
80 |
Bike auto approve |
Auto approve cost under the specified amount. |
IF DBA.ProductSubCategory.ProductCategory is equal to 1 AND StandardCost is less than 500.00 THEN ProductStatus equals Approved |
|
90 |
Accessory auto approve |
Auto-approve cost under the specified amount. |
IF DBA.ProductSubCategory.ProductCategory is equal to 4 AND StandardCost is less than 10.00 THEN ProductStatus equals Approved |
|
100 |
Bike costs review |
Notify the Bike Inventory Dept managers that bike cost information has been changed and it needs to be reviewed. |
IF DBA.ProductSubCategory.ProductCategory is equal to 1 AND ProductStatus is equal to ReviewCost THEN ProductStatus is not valid |
MDS Bike Dept Mgmt |
110 |
Accessory cost review |
Notify the Accessory Inventory Dept managers that accessory cost information has been changed and it needs to be reviewed. |
IF DBA.ProductSubCategory.ProductCategory is equal to 4 AND ProductStatus is equal to ReviewCost THEN ProductStatus is not valid |
MDS Accessories Dept Mgmt |
120 |
Bike costs rejected |
Notify the Bike Inventory Dept that bike cost information has been rejected and it needs to be adjusted. |
IF DBA.ProductSubCategory.ProductCategory is equal to 1 AND ProductStatus is equal to Rejected THEN ProductStatus is not valid |
MDS Bikes Inventory Dept |
130 |
Accessory costs rejected |
Notify the Accessory Inventory Dept that accessory cost information has been rejected and it needs to be adjusted. |
IF DBA.ProductSubCategory.ProductCategory is equal to 4 AND ProductStatus is equal to Rejected THEN ProductStatus is not valid |
MDS Accessories Inventory Dept |
140 |
Discontinued status |
Set a product’s status to discontinued. |
IF DiscontinuedItemInd is equal to Y THEN ProductStatus equals Discontinued |
|
Let’s create two of the rules we need. I’ll leave the rest for you to enter as an exercise.
Let’s add the priority 50 rule from above. This rule will demonstrate how to use an entity’s domain-based attribute’s attributes in a rule condition or action component.
Let’s add the priority 70 rule from above. This rule will demonstrate how to use the “has changed” condition.
Once all the business rules have been entered, on the Business Rule Maintenance page click the Publish button. On the confirmation dialog box, click OK . The rules’ statuses will change to Active .
Since MDS uses Windows integrated security, to test with different users you’ll need to change the settings in IE to prompt you for the user name and password. Then log in as the various users to test out the different parts of the workflow.
In IE, select Tools | Internet Options .
Before we begin testing the workflow you may want to log in as each of your users. This will do a couple of things automatically:
If you are using local users you will need to update their email address in MDS. Follow these steps for each user.
Now that the rules are published you are ready to try them out.
This is an example of the notification email you should receive.
As you can see, enabling human workflow in MDS is a powerful and creative way of using business rules.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.