Using Business Rules Composer in BizTalk Server 2009 : Walkthrough


Business Rules Composer in BizTalk Server 2009 is a great tool which enables us to separate the Business Rules from the actual process implementation.

Also, it gives the ability to implement shared BR across multiple processes, that means that the BR are shared, customizable, separately tested and modified as required.

This article is a quick walkthrough to demonstrate the usage of Business Rules Composer.  

In this sample I’m using BTS 2009, Visual Studio 2008 on Windows Server 2008

The sample about a leave request that needs to be validated against very simple business rule.

Building the sample

First, we need to build a BTS 2009 project, so create a new one in the Visual Studio.

Then, build the leave request schema as the following:


Build the message that will be sent to the BRE like the following:


Then build the business rule like that:

1. Add new Vocabulary


2. Name it [LeaveRequestData], and add a new definition like the following


Important: Remember to get the schema fully qualified name from the file properties window in Visual Studio, if you don’t but the fully qualified name you will not able to pass the parameters in Visual Studio when you try to call the rule.


Fill the definition like the following


Repeat the above from the [RequestedDays], [LeaveType] and the [ValidationResults], but for the [ValidationResults] make it [Set] operation.


3. Implement the first business rule like the following:


Implement the orchestration as the following:


Remember the Business Rules calling should be like that:


4. Now, it’s time to test our project:

a. Add strong name key and assign it to the project

b. In the deployment tab on the project properties screen, modify the application name to [BTS2009.Articles.BRE]

c. Deploy your solution

d. Configure the project as the following:

I’ll use three file ports, one to receive the incoming message, the second for the valid requests and the last one for the invalid requests.


e. Start your application

5. Implement 2 sample input message like the following:

Valid request message:

<ns0:LeaveRequest xmlns:ns0="http://BTS2009.Articles.BRE.EmployeeLeaveRequest">
  <Name>Ahmed Shokr</Name>

Invalid request message

<ns0:LeaveRequest xmlns:ns0="http://BTS2009.Articles.BRE.EmployeeLeaveRequest">
  <Name>Ahmed Shokr</Name>

6. Start your BTS application and paste the 2 sample messages to the [Intial requests] folder

You should see one message on the [Valid requests] folder and the other one should go to the [Invalid requests] folder.

7. Now, let’s modify the business rule to add a new case which is [Unpaid] vacation:


Deploy the new version of the business rule, restart the BTS Host Instance.

8. Update the Invalid message request message like the following:

<ns0:LeaveRequest xmlns:ns0="http://BTS2009.Articles.BRE.EmployeeLeaveRequest">
  <Name>Ahmed Shokr</Name>

However in this message the [RequestedDays] is greater than the [AvailableBalance] but the message should be moved to the [Valid requests] folder.

We can see that we applied modifications in the business rules without touching the application itself, and whatever BTS applications using this business rule, the new changes will apply without new modifications.

We can apply as much cases as we need, in the Business Rules Composer and it will apply on every application which is using the rule.

You can find the sample project plus the Policy files here

I hope that helped



  1. Ahmed, Thank you very much your project.
    I deployed the project once create those vocabulary and Policy. But i couldn’t see the Policy under Admin console. so the messages are not moving destination based on rules.

  2. Hi Raja,
    Please, check the following:
    1. Open the [Business Rules Composer] and see if it’s there.
    2. If it’s there, then open the project and open the [Call Rules] shape and see if the business rule is available.
    Check those and tell me what you got.

    1. Now i could see the policy under Admin of particular application once added the policy manually.
      If i drop valid & invalid message to input folder so the message should go separate valid & invalid folder but it is not happening like this. The both files are moving into 2 folders.
      we don’t have any specific pipeline rite? so i used pass through.
      Any ideas where i am doing mistake?

      1. Please, send me the sample project you made and the application configurations on the BTS admin console and I’ll try it and tell.

  3. Ahmed, Thanks for above sample.
    I need help in configuring call rule shape in orchrestration where it checks for an element in one xml and updates the element of another XML the final out folder should have only an updated XML file.

    For example: business rule will be on A.xml and on validating the rule updates the B.xml

    1. Hi, Sandeep
      Sorry for the late reply.
      What you can do is send XML to the BRE with output parameter (Set field), and in the action part of the business rule, update it.
      Then when it comes back to your Orchestration update B.xml with the new value.
      I hope that answered your question.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s