Business Rules Xtender

Author: ASI Consulting
VB Source Available: Contact Author
Project Page: n/a

Overview

iMIS Business Rules Xtender gives you the capability to create custom pop up messages to enhance the functionality of iMIS. With iMIS Business Rules Xtender, you can:

  • Easily create a set of Business Rules for records in the iMIS database
  • Notify the iMIS user when a specific record meets one of these rules
  • Run the Xtender application from a menu option within iMIS

Business Rules Xtender is a VB6 application which is integrated within iMIS and executes rules set up via a stored procedure. It was initially created to compensate for all the custom triggers which were set up in iMIS 4. Clients like VECCI had custom triggers set up with RAISERROR commands. The SQL RAISERROR command is not supported in iMIS10 and will cause customer portfolio crashes. As we all know custom triggers also make upgrading iMIS a pain, which is what makes this solution so great. What makes it even better, is that rules can be added and changed by simply modifying a stored procedure.
An example of some rules which have been set up by iMIS customers include:

  • Notify the user if the email address is blank for an active non company record.
  • Category and/or address cannot be blank for an active member
  • Display approved program qualifications for certain records
  • Individual cannot be linked to an inactive company
  • Member is less than 16 years of age

Installation Instructions

Step 1
Backup the following files:

  • xtender.ini (located in the main iMIS folder – usually C:\Program Files\iMIS 10)
  • LeftCust-Main.htm (located in the Framework\HiRes\Customers folder under the main iMIS folder)

Step 2
Copy the BusinessRulesXtender.ocx file to the main iMIS folder.

Double click the InstallBusinessRulesXtender.cmd file and click OK to the two pop-up boxes that alert the user that a file is being unregistered and then registered.

Step 3
Edit the Xtender.ini file and make the following changes:

  1. Add the following line to the end of a menu section (replace the Z in OptionZ with the next available option number):

    OptionZ= Business Rules,Business Rules,X,BusinessRules.BusinessRulesX,Business Rules

  2. Add the following lines to the end of the file (Location numbers are equivalent to "Location=X position ,Y position,Width, Height"):

    [BusinessRules.BusinessRulesX]
    Location=10,404,136,260

Step 4
Edit the LeftCust-Main.htm file and make the following changes:
Insert the following text before the closing " of the onload section in the BODY tag.
Note:Replace Z with the same option number as in step 3. Replace MenuName with the name of the menu section you used in step 3.

;SetWinLoc('imisproc:IMIS4.MenuName/Z')

For example, the section:
… onload="TopActivate('asimemlink')" oncontextmenu=";return false" …
would now read:
… onload="TopActivate('asimemlink');SetWinLoc('imisproc:IMIS4.Menu_Main1/1')" oncontextmenu=";return false" …

Step 5
Create the stored procedure named sp_BusinessRules, which will hold the rules that you want to set up.

Sample Rules

The following example, notifies the user if the active record does not have an email address. It also writes an exception activity to the database.
This is just an example of one simple rule that can be set up.

CREATE PROCEDURE sp_BusinessRules @bID varchar(10) = '',  @bUser varchar(10) = '', @nResult varchar(500) = '' OUTPUT
AS

set ansi_nulls off 
set ansi_padding off 
set ansi_warnings off 
set concat_null_yields_null off 
set quoted_identifier off
set nocount on

select @nResult = ''

/* Check if the record has an email address*/
if (select id from name where id = @bID and company_record = 0 and status = 'A' and email = '') is not null
	select @nResult = @nResult + '* Ask the customer for an email address *' + char(13)

/* create an exception activity and assign it to the user if this record is invalid */
if (@nResult <> '') and (@bUser <> '') and ((select UPDATED_BY from Name where ID = @bID) = @bUser)
and ((select count(*) from Activity where ID = @bID and ACTIVITY_TYPE = 'EXCEPTION' and SOURCE_CODE = @bUser) = 0)
begin
            declare @actseqn int, @tempint int
            set @tempint = 1
            exec sp_iboGetCounter 'Activity', @tempint, @FirstUnique = @actseqn OUTPUT

            insert into Activity (ID, SEQN, ACTIVITY_TYPE, PRODUCT_CODE, TRANSACTION_DATE,
                        EFFECTIVE_DATE, DESCRIPTION, NOTE, SOURCE_CODE, TICKLER_DATE)
            select @bID, @ACTSEQN, 'EXCEPTION', '', getdate(), getdate(), 'Invalid record', @nResult, @bUser, getdate()
end
return case @nResult when '' then 0 else 1 end

grant all on sp_BusinessRules to imis
GO

Sample Screen Shots

Notification

AttachmentSize
BusinessRulesXtender.zip21.25 KB

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

iMIS 15 and this Xtender

I downloaded the Xtender and I installed it on an iMIS 15 Beta 1 box. It is getting an error. Have you tried this on iMIS 15? I will be happy to make it work with iMIS 15, if it doesn't work there already. Of course, that would mean that you would have to share the source code.

Not Tested

The business rules xtender has not been tested with iMIS15. Unfortunately we have not been too exposed to iMIS15 yet here in Australia, so we have not been able to test such things. It has only been tested with iMIS10.

Would you be willing to share the source code?

I would like to use this product on our implementation.

It works with RC1

I just went into one of our test environments which has iMIS15 Release Candidate 1 installed. I set up Business Rules Xtender and it worked fine.
So it either does not work in the Beta version, or it was not installed correctly.

I am getting an error on RC1 (imis 15)

OMNISAXR is the title

Body:
Exception: Source=ADODB.Parameters Name=XtenderInit Msg=Item cannot be found in the collection corresponding to the requested name or ordinal.

Do you have any ideas?

Possible Fix

The most common mistake I can think of, is not configuring the "LeftCust-Main.htm" file properly. Are you sure you replaced the Z in ";SetWinLoc('imisproc:IMIS4.MenuName/Z')" with the option number in the xtender.ini (with a standard install Z=1).
Another thing that you might need to do, is to give permissions to the store procedure "sp_BusinessRules" to the imis group.