In a previous post, we learned how to use a variable on either side of a business rule condition. Now, we'll create a business rule that uses this type of condition.
We'll start with a story:
As a case owner, I want to be notified when someone else logs a note to my case, so that I can be kept informed of any activity on my cases.
The business rule
Here's the business rule which satisfies the user story.
Object Type: Case
Rule Name/Description: Notify the owner when someone else logs a note to their case
Start Events: Log Note
Cancel Events: None
Conditions: Logger != [Current Owner]
Action Title: Notify Owner
Who to Notify: [Current Owner]
Start Action: 0 minutes
From: Event Creation
Using: Elapsed Time
Repeat : Never
RE: A note was logged to [Object Type] [Object ID] by [Logger]
A note was logged to [Object Type] [Object ID] by [Logger]
Case Title: [Title]
You are being notified because you are the owner of the [Object Type].
Notes that were logged:
The rule condition
Look at the condition:
Logger != [Current Owner]
Notice that each side of the condition is actually a rule property that gets evaluated at runtime.
Notice that the message includes the actual notes that were logged by using the [Notes] variable.
This is not a baseline variable, its a custom one. I created this using the Business Rule Properties UI in DovetailAdmin:
Notice the "focus_obj2act_entry" part of the path. If you look at your schema, you won't see this relation defined anywhere. This is a special, virtual relation that Rulemanager knows how to handle. It knows how to translate "focus_obj2act_entry" into the actual relation based on the Object Type.
For example, for a Case, it translates focus_obj2act_entry to case_act2act_entry. For a subcase, it translates focus_obj2act_entry to subcase2act_entry. Etc. This is useful when you have one property that needs to work for multiple Object Types, such as "Case-Subcase", which means that this one property is for both cases and subcases. Kinda hokey, I know.
My notification preference is currently set to Email, so here's the email I received:
- We've created a business rule that notifies the case owner when someone else logs a note to their case
- Our business rule condition uses variables on both sides of the condition operator
- We've created and used a custom business rule property that allows us to include the text of a Log Note in a rule message