Creating a Business Rule

Creating a Business Rule

Introduction

In order to create a business rule there are certain elements that are required on each rule. These requirements can be found in the administrator training guide: Administrator Help Administrator Tools > Business Rules Creating a Business Rule. For Convenience of Business rule training the information from the Administrator Help is pasted below.

Creating a Business Rule

  1. Begin by selecting Current Record View in the Business Rule Editor snap-in.

Note:To toggle between Current Record View and Grid View, use this icon on the left side of the snap-in toolbar. You can also press Ctrl+G to toggle between the two views.

  1. Add a new record.
  1. Complete the following fields:
  • Start Type: Select the start type from the list:
  • After Update: Starts the business rule after the database has been updated.
  • Batch: Creates a batched workflow that runs on a schedule.
  • Before Update: Starts the business rule before the database is updated.
  • Workflow Name: Name the business rule.
  • Active: Select this check box to make the business rule active.
  • Wait for Execution: If this box is checked, you will have to wait for the results of the business rule to return before proceeding. If this box is not checked, the workflow will run prior to the completion of the business rule's execution.
  1. Click and drag activities from the Activity Pane into the Workflow Editor.

Note: A result activity must be dropped inside the dotted outline around the trigger activity to which it is associated in order to be involved in the trigger activity workflow.

style

Note: There can only be one trigger per business rule. A result does not turn into a trigger to which another result can be attached. A separate business rule must be created for a different trigger, even if this trigger is the same as the result of a business rule.

  1. For both the trigger and each result, select or type all required (indicated by an asterisk) and relevant data in the Activity Configuration snap-in. See "Activity Configuration Snap-in" for more detailed instructions on configuring the Activity Configuration snap-in for each activity.
  1. Configure the business rule for either Non-batched Workflows or Batched Workflows:

Non-batched Workflows / Batched Workflows
To run the business rule when a snap-in is modified, select desired parameters in the Non-batched Workflows snap-in. See "Non-batched Workflows Snap-in" for more information. / To automatically run the business rule on a schedule, select desired parameters in the Batched Workflows snap-in. See "Batched Workflows Snap-in" for more information.
  1. Indicate the agencies that this workflow will be executed for in the Execute For The Following Agencies snap-in. By default, all the agencies are selected.
  1. Save the session.

The business rule is now complete and will run according to the settings configured in the steps above.

Business Rule Exercises

[Ctrl + Click] on the number to jump straight to the rule

# 1 - Add an Event Add a Document

# 2 - New Future Event Added  Notify Involved Names

# 3 - Send Email for Name Record Change

# 4 - Case Status Change  Notify Names (Elected Official)

# 5 - Continued Event > Auto-Reschedule

# 6 - Copy CaseInvPers to Future Events

# 7 - Duplicate Name Detection

# 8 - Batch Continued Events > Reschedule

# 1 - Add an Event Add a Document

Description: This rule will add new document when an event is added.

Prerequisites & Dependencies:

  1. Event Type: Motion Hearing (or whatever event trigger you would like to use)
  2. Document Type: Motion JDA Document (or whatever document result you would like to use)

Rule:

Instructions:

1.Create a New Business Rule

  1. Start Type: After Update
  2. Workflow Name: New Future Event Added - Notify Involved Names
  3. Active: selected
  4. Wait for Execution: selected
  5. Execution Type: JustWare

2.Drag in an [EventEngineTrigger] activity.

3.In the [EventEngineTrigger] section of the activity, fill out the 'Activity Configuration' snapin as follows:

  1. Event Type: Motion Hearing

4.Drag in a [EventEngineResult] Activity

5.In the [EventEngineResult] Activity fill out the Activity Configuration snapin as follows

  1. Result Event Type: Motion

6.In the 'Non-batched Workflows' snapin, add the following:

  1. Snap-in Name: case:Events (specifying the snapin where this rule will execute)
  2. Insert: check this box to execute rule only when new rows are inserted


7.In the 'Execute for the following Agencies' snapin, select the appropriate agencies for your workflow:

8.The rule should now look like this and is ready for testing:

# 2 - New Future Event Added  Notify Involved Names

Description: This rule will send an email notification to case involved parties (as specified in the rule) when a new/future event gets added to a case.

Prerequisites & Dependencies:

  1. Case Involved Party code table set up
  2. JustWare users' name records must have an email address
  3. Email Notifications should be configured in the JustWare Maintenance Console
  4. Notification Template setup (see Administrator Help Administrator Tools > Notifications)

Rule:

Instructions:

9.Create a New Business Rule

  1. Start Type: After Update
  2. Workflow Name: New Future Event Added - Notify Involved Names
  3. Active: selected
  4. Wait for Execution: selected
  5. Execution Type: JustWare

10.Drag in an [IfElse] activity.

11.In the [ifElseBranch1] section of the activity, fill out the 'Activity Configuration' snapin as follows:

  1. DataSet: Inserted Data
  2. Snap-in Name: case:Events
  3. Select String: 1 = 1 (will go down this path EVERY time a new row gets inserted into the 'Events' snapin)

12.Ensure you have a notification template created for this business rule. Here is an example of what this might look like (see Administrator Help Administrator Tools > Notifications):

13.Drag in a [NotifyInvolvedNames] activity into the Activity Pane:

14.In the [notifyInvolvednames1] section of the activity, fill out the 'Activity Configuration' snapin as follows:

  1. Send Email To: Case Involved People
  2. Involvement Types (Select the appropriate involvements to receive the email)
  3. Template: Select the template you have created to use for this notification.

15.In the 'Non-batched Workflows' snapin, add the following:

  1. Snap-in Name: case:Events (specifying the snapin where this rule will execute)
  2. Insert: check this box to execute rule only when new rows are inserted

16.In the 'Execute for the following Agencies' snapin, select the appropriate agencies for your workflow:

17.The rule should now look like this and is ready for testing:

# 3 - Send Email for Name Record Change

Description: This rule will send an email notification to any user if their name information (Name Information, Address, Phone) gets updated by another JustWare user other than themselves.

Prerequisites & Dependencies:

  1. JustWare users' name records must have an email address
  2. Email Notifications should be configured in the JustWare Maintenance Console
  3. Notification Template setup (see Administrator Help Administrator Tools > Notifications)

Rule:

Instructions:

  1. Create a New Business Rule
  2. Start Type: After Update
  3. Workflow Name: Email for Name Record Change
  4. Active: selected
  5. Wait for Execution: selected
  6. Execution Type: JustWare
  7. Drag in an [IfElse] activity.
  8. Drag in an [IfElse] activity
  9. In the [ifElseBranch1] section of the activity, fill out the 'Activity Configuration' snapin as follows:
  10. DataSet: Updated Data
  11. Snap-in Name: name:Name Information
  12. Select String: 1 = 1 (will go down this path EVERY time a row gets updated into the 'Name Information' snapin)
  13. Drag a [GetData] activity in
  14. In the [getData1] section of the activity, fill out the 'Activity Configuration' snapin as follows:
  15. Select String:

SELECTTOP 1 -- Grabbing the top one that was most recently updated (see ORDER BY)
n.NameIDASNameID-- NameID of the Name Record that just got saved
,n.ModbyNameIDASModByNameID-- NameID of the last person who modified this Name Record
,(SELECTNameIDFROMjw50_AgencyOfCurrentUser)ASCurrentUserNameID-- Getting the Current User's NameID
FROM
jw50_AppPersonASap
JOINjw50_NameASnON (ap.NameID=n.NameID)
WHERE
ap.AppPersonIsActive= 1 -- Active Checkbox is checked in System Administration > Security > Application Person
ANDap.UserDescriptionISNOTNULL-- Login field is not blank in System Administration > Security > Application Person
ANDap.NameID=@[row.NameID]-- The NameID of the current name record you are on in JustWare will be passed here
ANDap.NameIDNOTIN(SELECTNameIDFROMjw50_AgencyOfCurrentUser)-- Filtering the results to not show anything if "Person" modifies their own name record
ORDERBY
n.ModDtDESC-- Grabbing most recently updated row
  1. Name of Data Table: Errors (this will be referenced in Step 6 below)
  1. In the [ifElseBranch3] section of the activity, fill out the 'Activity Configuration' snapin as follows:
  2. DataSet: Original Data
  3. Snap-in Name: JusticeBroker: Errors (Note*: "Errors" is the name of the Data Table we defined above in Step 5)
  4. Select String: NameID > CurrentUserNameID
  1. Ensure you have a notification template created for this business rule. Here is an example of what this might look like (see Administrator Help > Administrator Tools > Notifications):
  2. Drag in a [SendNotificationEmail] activity into the Activity Pane:
  3. In the [SendNotificationEmail1] section of the activity, fill out the 'Activity Configuration' snapin as follows:
  4. Template: Select the template you have created to use for this notification.

  5. In the "ifElse1" section, right-click and select: Add Branch:
  6. Your Screen should now look something like this:
  7. In the [ifElseBranch2] section of the activity, fill out the 'Activity Configuration' snapin as follows:
  8. DataSet: Updated Data
  9. Snap-in Name: name:Phone
  10. Select String: 1 = 1 (will go down this path EVERY time a row gets updated into the 'Phone' snapin)
  11. Drag a [GetData] activity in

  12. In the [getData2] section of the activity, fill out the 'Activity Configuration' snapin as follows:
  13. Select String:

SELECTTOP 1 -- Grabbing the top one that was most recently updated (see ORDER BY)
p.NameIDASNameID-- NameID of the Name Record that just got saved
,p.PhoneModByNameIDASModByNameID-- NameID of the last person who modified this Name Record
,(SELECTNameIDFROMjw50_AgencyOfCurrentUser)ASCurrentUserNameID-- Getting the Current User's NameID
FROM
jw50_AppPersonASap
JOINjw50_PhoneASpON (ap.NameID=p.NameID)
WHERE
ap.AppPersonIsActive= 1 -- Active Checkbox is checked in System Administration > Security > Application Person
ANDap.UserDescriptionISNOTNULL-- Login field is not blank in System Administration > Security > Application Person
ANDap.NameID=@[row.NameID]-- The NameID of the current name record you are on in JustWare will be passed here
ANDap.NameIDNOTIN(SELECTNameIDFROMjw50_AgencyOfCurrentUser)-- Filtering the results to not show anything if "Person" modifies their own name record
ORDERBY
p.PhoneModDtDESC-- Grabbing most recently updated row
  1. Name of Data Table: Errors (this will be referenced in Step 6 below)
  1. Drag in an [IfElse] activity
  2. In the [ifElseBranch6] section of the activity, fill out the 'Activity Configuration' snapin as follows:
  3. DataSet: Original Data
  4. Snap-in Name: JusticeBroker: Errors (Note*: "Errors" is the name of the Data Table we defined above in Step 14)
  5. Select String: NameID > CurrentUserNameID
  1. Ensure you have a notification template created for this business rule. Here is an example of what this might look like (see Administrator Help > Administrator Tools > Notifications):
  2. Drag in a [SendNotificationEmail] activity into the Activity Pane:
  3. In the [SendNotificationEmail2] section of the activity, fill out the 'Activity Configuration' snapin as follows:
  4. Template: Select the template you have created to use for this notification.

  5. In the "ifElse1" section, right-click and select: Add Branch:
  6. Your Screen should now look something like this:
  7. In the [ifElseBranch5] section of the activity, fill out the 'Activity Configuration' snapin as follows:
  8. DataSet: Updated Data
  9. Snap-in Name: name: Address
  10. Select String: 1 = 1 (will go down this path EVERY time a row gets updated into the 'Address' snapin)
  11. Drag a [GetData] activity in
  12. In the [getData3] section of the activity, fill out the 'Activity Configuration' snapin as follows:
  13. Select String:

SELECTTOP 1 -- Grabbing the top one that was most recently updated (see ORDER BY)
.NameIDASNameID-- NameID of the Name Record that just got saved
,a.AddressModByNameIDASModByNameID-- NameID of the last person who modified this Name Record
,(SELECTNameIDFROMjw50_AgencyOfCurrentUser)ASCurrentUserNameID-- Getting the Current User's NameID
FROM
jw50_AppPersonASap
JOINjw50_AddressASaON (ap.NameID=a.NameID)
WHERE
ap.AppPersonIsActive= 1 -- Active Checkbox is checked in System Administration > Security > Application Person
ANDap.UserDescriptionISNOTNULL-- Login field is not blank in System Administration > Security > Application Person
ANDap.NameID=@[row.NameID]-- The NameID of the current name record you are on in JustWare will be passed here
ANDap.NameIDNOTIN(SELECTNameIDFROMjw50_AgencyOfCurrentUser)-- Filtering the results to not show anything if "Person" modifies their own name record
ORDERBY
a.AddressModDtDESC-- Grabbing most recently updated row
  1. Name of Data Table: Errors (this will be referenced in Step 6 below)
  1. Drag in an [IfElse] activity
  2. In the [ifElseBranch9] section of the activity, fill out the 'Activity Configuration' snapin as follows:
  3. DataSet: Original Data
  4. Snap-in Name: JusticeBroker: Errors (Note*: "Errors" is the name of the Data Table we defined above in Step 24)
  5. Select String: NameID > CurrentUserNameID
  1. Ensure you have a notification template created for this business rule. Here is an example of what this might look like (see Administrator Help > Administrator Tools > Notifications):
  2. Drag in a [SendNotificationEmail] activity into the Activity Pane:
  3. In the [SendNotificationEmail3] section of the activity, fill out the 'Activity Configuration' snapin as follows:
  4. Template: Select the template you have created to use for this notification.
  5. In the 'Non-batched Workflows' snapin, add the following:
  6. Snap-in Name: name: Phone, name: Name Information, name: Address (specifying the snapin(s) where this rule will execute)
  7. Insert: check this box to execute rule only when new rows are inserted

  8. In the 'Execute for the following Agencies' snapin, select the appropriate agencies for your workflow:
  9. The rule should now look like this and is ready for testing:

# 4 - Case Status Change  Notify Names (Elected Official)

Description: This rule will send an email notification to the Elected Official that is listed on the Application Parameters anytime that the Case Status gets changed.

Prerequisites & Dependencies:

  1. Applications Parameter setup of Parameter (ElectedOfficial)
  2. Go to:Code Tables > Application Parameters > Add a Parameter of "ElectedOfficial" with a PValue of "JustWare NameID" of your elected official

  3. Notification Template setup (see Administrator Help > Administrator Tools > Notifications)

Rule:

Instructions:

1.Create a New Business Rule

  1. Start Type: After Update
  2. Workflow Name: CaseStatusChange - NotifyNames
  3. Active: selected
  4. Wait for Execution: selected
  5. Execution Type: JustWare

2.Drag in an [IfElse] activity.

3.In the [ifElseBranch1] section of the activity, fill out the 'Activity Configuration' snapin as follows:

  1. DataSet: Updated Data
  2. Snap-in Name: case:Information
  3. Select String: {Status} > Status (The field that is listed inside the Curly Brackets is the original value in the database. It will be evaluated to see if it has changed or stayed the same. The listed syntax of {Status} > Status is basically saying "Has the status changed or stayed the same?")

4.Ensure you have a notification template created for this business rule. Here is an example of what this might look like (see Administrator Help > Administrator Tools > Notifications):

5.Drag in a [GetData] activity into the Activity Pane:

6.In the [GetData] section of the activity, fill out the 'Activity Configuration' snapin as follows:

  1. Select String:

SELECT
CaseIDASCaseID
,(SELECTPValueASNameIDFROMjw50_ApplicationParametersWHEREParameter='ElectedOfficial')ASNameID
FROM
jw50_Case
WHERE
CaseID=@[row.CaseID]
  1. Name of Data Table: ElectedOfficial

7.Drag in a [SendEmailNotification] activity into the Activity Pane:

8.In the 'Activity Configuration' snapin, add the following:

  1. Template: Case Status Change (specifying the Notification Template that you will be sending out for this rule. (see Administrator Help > Administrator Tools > Notifications).

9.In the 'Non-batched Workflows' snapin, add the following:

  1. Snap-in Name: case:Information (specifying the snapin where this rule will execute)
  2. Update: check this box to execute rule only when the existing case status is updated

10.In the 'Execute for the following Agencies' snapin, select the appropriate agencies for your workflow:

11.The rule should now look like this and is ready for testing:

# 5 - Continued Event > Auto-Reschedule

Description: This rule will re-schedule specific events when the event status is changed to ‘Continued’. This rule works best in conjunction with Docket Management. In the example, when an arraignment hearing is continued, another arraignment hearing will be scheduled. This rule has the potential to work for a variety of events based on need.

Prerequisites & Dependencies:

  1. Event Status of ‘Continued’ configured in the code table, with a Mastercode = "2 – Continued"

Rule:

Instructions:

  1. Create a New Business Rule
  2. Start Type: After Update
  3. Workflow Name: Continued Event > Auto-reschedule
  4. Active: selected
  5. Wait for Execution: selected
  6. Execution Type: JustWare
  7. Drag [EventEngineTrigger] into the workflow activity pane.
  1. Fill out the Activity Configuration as follows:
  2. Event Type: Arraignment Hearing
  3. Event Status: Continued