Web-based BRE composer
  • 01 May 2018
  • 7 Minutes to read
  • Dark
    Light
  • PDF

Web-based BRE composer

  • Dark
    Light
  • PDF

Article Summary

The BizTalk360 Business Rules Composer has been developed to work exactly the same way as it works in BizTalk. However, we have added few additional components to the feature that will be useful for business users while creating business rules. With the BizTalk360 Business Rules Composer, you can create more advanced and complex business rules to suit your business scenarios.

  1. "Where" function We have developed a new function 'Where' that can be used as an argument to query the database tables and retrieve the information. You can do this using the BizTalk Business Rule Composer, but it is much harder to read and understand. This function can be used as an argument within the actions (then) part of the business rule. The "where" function has some inbuilt validations that are in place - Users must provide 3 values to the where function. The first and second value must be custom vocabulary that targets the database we want to query
  • The first value must be of the same data type as the parent argument of the where function
  • The second value must target the same table as the first argument
  • The third argument can either be a manual input or a custom vocabulary that is of the same data type as the second value of the where function
  1. If, Else, Else If In addition to the existing statements And, Or, Not, the BizTalk360 Business Rules Composer contains three additional statements - If, Else, Else If. These statements can be applied to the actions (then) part of the business rule to create more complex business rules. While creating a business rule, each "if" block will be considered as a separate rule and you will notice multiple rules with suffix information (alphanumerical values) getting created for each if block when the rule is saved.

  2. Date Time Picker Any function that involves picking a date/time (datetime data type) contains the date time picker (calendar) option. We have built this functionality to minimize the errors while creating the business rules and for ease of using the tool for business users.

  3. Download Test Result With the BizTalk360 Business Rules Composer, you can download the modified XML file through the Download Test Result button. Test policy for 'XML values' will not change the values in the XML File directly for Security Reasons. Instead, the modified file will be available as a zip file for download.

Adding a New Policy and Business Rule

Follow the following steps to create a new business policy and a new version using the BizTalk360 Business Rules Editor.

  • Log into BizTalk360
  • Expand the 'Rules section'. Click 'Business Rules Composer' from the drop down.
  • Under the Policies Pane, click 'Add New Policy'
  • You will notice the policy getting created with a default name "Policy 1". You can edit the name right away, or later by selecting Policy 1 and clicking 'Edit'.
  • Once a policy is created, a new version is automatically created underneath the policy with the name 'Version: 1.0 Not Saved'
  • You can start to create a new rule at this step if you only need one version of the business policy. To create another version, click Add New Version. The new version will be created as Version: 1.1 Not Saved.
  • Once a policy is created, a new version is automatically created underneath the policy with the name 'Version: 1.0 Not Saved'. Select the version and click Add Rule.
  • From the Vocabulary Pane, expand the functions and predicates to get the detailed list
  • All the functions and predicates in the list are the same as what is available in the BizTalk Business Rules Composer. Also, you cannot create any vocabularies directly from BizTalk360. The current version of BizTalk360 supports the creation of custom vocabularies only in the BizTalk Business Rules Composer.
  • Drag the predicates towards the 'if'' block and functions towards the 'then' block to build your business rule. You can also use your custom vocabulary that you defined to create the business rule. In the below screenshot, we will be taking an example from one of the custom vocabularies that we created for this purpose.

Saving, Publishing and Deploying the Policy

  • Follow all the steps from "Adding a New Policy and Business Rule" section
  • Once you have finished creating the business rule, select the version (Version: 1.0 Not Saved). Click Save.You will notice that the version details change to Version 1.0 Saved. Once a rule is saved, you will notice the next level of rule information being created with the same rule name suffixed by alphanumeric characters.

You will still be able to edit the business rule by selecting the entry with the rule name alone. The second level entry of the rule information (with the suffix details) will be only read-only.
  • Once the business rule version is saved, you will notice the Publish button getting activated. You can Publish a business rule once it has been saved.
  • Click the 'Publish' button to publish the business rule. You will notice the version details changes to Version 1.0 Published.

Testing the Policy

It is a best practice to test the policy before actually deploying the policy/version into the production environment. To test the policy using BizTalk360 Business Rules Composer, you need to specify one or more instances for the following fact types - XML Documents, Database Tables, and .NET Classes.

To understand how to work with the BizTalk360 Business Rules Composer's Policy testing section, we will consider one classic example of processing a purchase order. The rule to be tested is when an XML, containing the purchase order information, has a quantity less than or equal to 500, the purchase order must be approved. If the quantity is greater than or equal to 500, the purchase order must be denied. To test this using the BizTalk360 Business Rules Composer, let's assume the business policy (version) has been created and published.

Follow the following steps to test the policy with the XML schema file.

  • Log into BizTalk360
  • Expand the 'Rules section'. Click 'Business Rules Composer' from the drop down.
  • Select the policy from the list in the Policies pane. In our case, let's select the ProcessPurchaseOrder policy.
  • Select the appropriate version of the policy from the drop-down. Let’s select Version 1.1 Published.
  • Once you select the version information from the policies pane, you will notice that the Help/Rules Creation Pane would now become the Policy Testing pane. The policy testing pane contains the following sections:
  1. Fact Types - Lists the fact types - XML Documents, Database Tables, and .NET Classes
  2. Select File - Option to choose the XML file. When adding a Database Table, this option would display as "Add Instance". Similarly, when adding a .NET Class, this would display as "Create Fact". Once you have added the input for the fact type, when you select the input file, you will notice the button changing to Remove Instance.
  3. Test - The rule engine fires the test and the result is displayed in the results pane
  4. Download Test Result - This is a new functionality in BizTalk360 Business Rules Composer. This button will be displayed only when the test is trying to change the value in the XML file (the status field in this case!). As per the above scenario, when the input file contains a value (quantity) less than or equal to 500 (say, 400), the status of the purchase order should be changed to "Approved". When the BizTalk360 Business Rules Composer is trying to make this change, you will notice the Download Test Result button. Clicking on the button will download the "modified" purchase order (where status is set to Approved). On the other hand, when the rule doesn't match, you will not see the Download Test Result button.
  5. Result Execution pane - The pane that displays the test execution result, just like the BizTalk Business Rules Composer
  • For our scenario, we will only be using the 'XML Documents' facts type to test the business rule. Expand the (+) next to XML Documents and select RuleTest.PO (since we have constructed the rule to be based on the schema file, you will notice the RuleTest.PO appearing as a drop-down).
  • Once you have selected the schema file, click Select File. You will be prompted to choose the XML input file (in our example the purchase order file). Let's say we have 2 purchase orders - PO1.xml & PO2.xml. Select the PO1.xml file.
  • Click Test
  • Depending on the result, if any of the purchase orders matches the rule condition, you will notice the Download Test Result button appearing next to the Test button.
  • Click the Download Test Result button to download the test result file (that contains the modified values - Status = Approved)
  • The process remains the same for the PO2.xml file as well. If the input file contains the quantity value >=500, the condition will not be met and no changes will be done to the input file. In this case, you will not see the Download Test Result button.

BRC.gif

This example shows you to add a new policy Version 1.0 followed by save, publish deploy and test the policy in BizTalk360 Business Rules Composer.


Was this article helpful?

ESC

Eddy, a super-smart generative AI, opening up ways to have tailored queries and responses