REQUEST A DEMO

Interesting Business Rule using MTM properties and aliases

I was recently presented with an interesting business rule requirement from a customer.

the objective here is when someone closes a case, I can use Rulemanager to send an email to the related CR owner.

 

Lets give it a whirl.

Data Model

 

First, lets recall the data model.

 

Cases are linked to solutions (probdesc/workaround), and solutions are linked to Bugs (CRs, Change Requests).

 

Case >—  Workaround  >— Probdesc >—<  Bug

 

A case is related to one workaround, a workaround is related to one probdesc, and a probdesc can be related to many CRs.

 

So we have a MTM in play (between probdesc and bug) – which makes this a bit interesting, and uncommon.

Applications In Use

 

I’m using Dovetail Admin for configuring rules and rule properties, and Dovetail Rulemanager for processing the rules.

Rule Properties

 

We’re going to need some new rule properties and aliases.

Setup a new rule property (recipient alias) for related CR owners

 

We’ll use this to define *who* should be notified – namely the owners of the CRs that are linked to the solution that is linked to the case.

 

Path: case_soln2workaround:workaround2probdesc:probdesc2bug:bug_owner2user:login_name

 

Notice that the subtype is an Alias.

clip_image001

Setup a new rule property for related CR ids

 

We’ll use this in the business rule message – giving us the list of CRs that are linked to the solution that is linked to the case.

 

Path: case_soln2workaround:workaround2probdesc:probdesc2bug:id_number

 

Notice that the subtype is a Property.

clip_image001[5]

Setup a new rule property for Linked Solution ID

 

We’ll use this in the business rule message – giving us the ID of the solution that is linked to the case.

 

Path: case_soln2workaround:workaround2probdesc:id_number

clip_image002

Setup a business rule

 

We’ll setup a business rule to notify the related CR owners when something happens on a case:

 

Notify the related CR owners (using the property we setup earlier):

clip_image003

 

Send them a message. In the message we can include the Case ID, the Solution ID, and the list of CR IDs.

 

clip_image004

Perform the action that starts the rule (such as a close case)

 

In my test, I just fired it on a log notes.

 

In my test scenario, I have 1 case linked to 1 solution, and that solution is linked to 2 CRs, each with a different owner.

You should see notifications get sent to the CR owner(s):

 

email notification, sent to the two recipients:

clip_image005

Success!

 

It works!

 

Obviously, if this was a production rule, we’d make the rule message nicer, and probably turn those ID numbers into hyperlinks.

Behind the scenes

 

Looking in the Rulemanager log, I can see how the Related CR IDs was expanded, and its result, which is a string that is a list of CR IDs:

[Consumer2] DEBUG FChoice.RuleManager.QueryBuilder – Path “case_soln2workaround:workaround2probdesc:probdesc2bug:id_number” expands to SQL command “SELECT T3.objid, T3.ID_NUMBER FROM table_case T0, table_workaround T1, table_probdesc T2, table_bug T3, mtm_probdesc12_bug28 M0 WHERE T0.objid = {0} AND T0.case_soln2workaround = T1.objid AND T1.workaround2probdesc = T2.objid AND T2.objid = M0.probdesc2bug AND M0.bug2probdesc = T3.objid ORDER BY T3.objid DESC”

[Consumer2] DEBUG FChoice.RuleManager.StandardPropertyTokenExpansionService – Property “Related CR IDs”using “case_soln2workaround:workaround2probdesc:probdesc2bug:id_number” expands to “23,21”

 

Cool.

Clarify Rulemanager

 

The customer tried my suggestions, but it didn’t work for him. Ugh.

 

The only difference is that the customer is using Clarify Rulemanager instead of Dovetail Rulemanager.

 

So why didn’t it work with Clarify Rulemanager?

 

I replicated the problem on my machine, and the logs proved helpful.

 

I can see it resolving the Related CR Owners (which traverses through the probdesc2bug MTM):

Info Verbose    1968    0    Mapping ‘Related CRs – Owners’ to path… ‘Related CRs – Owners’ is a Alias Name.
Info Medium    1968    0    Property [Related CRs – Owners] evaluated to ‘sa annie ‘

 

But resolving the related CR IDs failed (which traverses through the same probdesc2bug MTM):

Info Verbose    1968    0    Mapping ‘Related CR IDs’ to path… ‘Related CR IDs’ is a Property Name.
loc_dbg_print: Found string ‘Relation ‘%s’ in the relation path cannot be traversed.
Info Medium    1968    0    Property [Related CR IDs] evaluated to ‘[Related CR IDs=???]’

 

WTH?

 

Why would it resolve one but not the other?

 

The only difference between the two is that one property has a subtype of Alias, and one has a subtype of Property.

Rule Property Subtypes: Alias vs. Property

 

So, I changed the ‘Related CR IDs’ rule property  to have a subtype of Alias, and then it worked!

 

The log shows:

Info Verbose    1968    0    Mapping ‘Related CR IDs’ to path… ‘Related CR IDs’ is a Alias Name.
Info Medium    1968    0    Property [Related CR IDs] evaluated to ’21 23 ‘

 

As you can see, if its an Alias, it is properly evaluated.

 

This indicates that the property evaluation mechanism within Clarify Rulemanager is different depending on the subtype (alias or property). Unexpected, but true.

 

There is one small downside to this workaround – since your property is now defined as an alias, it will not show up in the list of variables on the Business Rule Message Form. And it will show up in the list of Business Rule Recipients on the Business Rule Actions form. Small price to pay to get the desired functionality.

 

This information is also documented in our knowledgebase on our Dovetail SelfService site.

Learn More

 

For more information on Rule Properties, have a look at the Business Rule and Rule Properties page on theRulemanager wiki.

Still learning

 

After all of these years of doing Clarify, it’s amazing I keep learning new stuff.

 

Hope you find this useful.

 

Rock on.