Migrate a business rule from one database to another
Gary Sherman
November 13, 2007

I was working with a customer today, and they mentioned that one task that is problematic for them is moving business rules from their test database into the production database. Currently, the business rule is manually created via the Clarify Client in the test instance, and then when its all working, it is then again manually re-entered into the production. Manual re-entry is a point of potential failure. The rule may have been perfect in test, but a simple typo when re-entering it in production can cause havoc.

One solution to this issue is to archive the business rule using ArchiveManager or dataex from the test database, and then use ArchiveManager or dataex to import it into production.

Business Rule

First, I created a new business rule in my test system:

Object Type:Case
Rule Name/Description:New Employee Request
Start Event:Dispatch
Cancel Events:None
Conditions:Case Type = New Employee
Action Title:Create Subcases
Message Type:Command Line
Start Action:0 minutes
From:Event Creation
Using:Elapsed Time
Message:C:\WINDOWS\system32\WINDOW~1\v1.0\powershell.exe C:\work\PowerShell\CreateNewEmployeeSubCases.ps1 “[Object ID]”

Directive File

We need a directive file, which tells ArchiveManager exactly what to archive. Here’s an example:

This directive file tells ArchiveManager to archive the business rule. It will also archive out its related start events, cancel events, conditions, and actions.

I save the above text into a file named bizrule.dir

Be sure to edit the WHERE clause so that you’re exporting the business rule that you want.

Export the Business Rule

diet.exe -export businessrule.dat -archive -dir bizrule.dir -expdef

export

 

Note: although my screenshot doesn’t show it, you should use the -expdef option, which will export all fields, including empty strings and NULLs.

Import the business rule into the production database

diet.exe -import businessrule.dat

import

View the rule in the new database

Using BOLT, I can view that the rule now exists in the target database:

rule 

And there it is. I’ve just migrated a business rule from one database to another, without manually re-typing it.

Rock on.

2 Comments to "Migrate a business rule from one database to another"
  1. Jobin says:

    For example, I have database A and database B. I have business rule B1 available in both the database. However I have taken the business rule B1 from database A and performed the modification on the few conditions (table_rule_cond). Now i am importing the business rule B1 in to the database B. (The title and the name of the business rule is same in table_com_tmplte on both the databases). In this scenario, is there any way to replace the existing business rule in the database B with the .dat file from database A.???

  2. gsherman says:

    Hi Jobin,

    With DAT files, you can do an update or an insert.
    So you can update existing rule conditions (as long as their is a unique key), or you can insert new ones.
    But, you cannot delete rows using DAT files.
    So, depending on your exact scenario, it might be easier to delete the rule from your target database first, and then import the rule using the DAT file.
    You could have a script that deletes the rule, then recreates it using the DAT file.
    Hope this helps.

Leave a Comment

International: +1 (512) 610-5400
Toll Free: 1 (800) 684-2055