Contents
Rule Authoring for iWD
Rule authoring for iWD is done through the Genesys Rules Authoring Tool (GRAT). This section describes general information about using GRAT for iWD, and how to use it for creating decision tables, linear rules, and business calendars.
Login Permissions
The User permissions to the various capabilities of the GRAT are controlled by Role-Based Access Control, which is configured through Genesys Administrator (if you are not using Genesys Administrator, you will have full access to the GRAT).
See Role-Based Access Control in the Genesys Rules System Deployment Guide.
Configuring iWD Tenant and User for GRAT Access
To complete the necessary configuration of an iWD managed tenant and an iWD user's security role, so that the Rules Authoring link appears on the iWD Manager navigation bar, properly launch the Genesys Rules Authoring Tool web application, and log in the user, complete the following procedure.
Procedure
- Log in to iWD Manager as a user with full administrative privileges.
- From the Tenant drop-down list, select your iWD-managed tenant.
- Select the Profile link.
- Under Genesys Rules Authoring Tool URL, enter a valid URL for the Genesys Rules Authoring Tool.
- Test this URL in a separate browser window to ensure that it brings up the login screen.
- The default syntax for the URL should be:
- http://<host>:<port>/genesys-rules-authoring
- where;
- <host>—Is your application server host name.
- <port>—Is the listening port of your application server (usually 8080 by default).
- genesys-rules-authoring—Is the name of the Genesys Rules Authoring Tool web application that is deployed on your application server. (This will be the default name of that web application unless you have modified it.)
- Click Save.
- Select the Security Policy link.
- Select the name of an existing Security Role, to which you want to give access to the Genesys Rules Authoring Tool, or create a new one.
- Scroll down to the Application Permissions section.
- Under the Run column, check the checkbox for the Rules Authoring permission.
- Click Save.
Configuring GRAT Access Control to IWDBP
When you launch GRAT from iWD Manager, the active tenant will be the Configuration Server tenant that is linked to the iWD managed tenant you were working with in iWD Manager. The GRAT navigation tree will display the iWD Solutions that are configured under the tenant. If you don't see any Solutions in the navigation tree, but you have one or more Solutions configured in iWD Manager, you must ensure that the user has permission to the appropriate folders under the Business Structure folder in Configuration Server.
Procedure
To configure access control for the Genesys Rules Authoring Tool user, to allow him/her to see the appropriate iWD Solutions when logged into GRAT, do the following:
- Log in to Genesys Administrator or Genesys Configuration Manager.
- Navigate to the tenant that maps to the iWD managed tenant with which you are working.
- Locate the Business Structure folder (in Genesys Administrator, go to Environment > Business Units/Sites).
- In the Business Structure folder, locate the iWD Solution folder to which you want the Genesys Rules Authoring Tool user to have access.
- If you are using Genesys Configuration Server:
- On the Security tab of that iWD Solution, configure at least Read access for the Genesys Rules Authoring Tool user, or for at least one Configuration Server Access Group to which that user belongs.
- Highlight the iWD Solution folder and select Edit.
- Select the Permissions tab.
- Use either Add Access Group or Add User to configure at least Read access to this iWD Solution, for the necessary Genesys Rules Authoring Tool user or his Access Group(s).
ImportantWhen you add the user or Access Group, you can decide whether or not to propagate the permissions. If you do not propagate the permissions, you will need to explicitly add permissions to the Department(s) and Process(es) under the iWD Solution, to which you want the user or access group to have access.
- To grant access to any additional iWD Solutions, repeat Steps 4 to 6.
If you are using Genesys Administrator:
Creating a New Rules Package
Summary
The rule package is the parent object for all the business rules for an iWD Solution.
- Log in to iWD Manager and launch the Genesys Rules Authoring Tool.
- In the navigation tree, expand the Solution with which you want to work.
- Select New Rule Package.
- On the right side of the screen, fill in the properties for the rule package, such as.
- Package Name—Used internally and primarily in the Configuration Server List Object that will be read in the iWD business process, so the business process knows which rule package should be evaluated by the Genesys Rules Engine. There are some reserved keywords that must not be used when you name the rule package. See Creating Rule Packages topic in the GRAT Help.
- Business Name—Enter any user-friendly name you wish to provide to identify the rule package.
- Package Type—Select iWD. Selecting iWD will ensure that the list of available rule templates of type iWD will be displayed.
- Rule Package (Optional)—Enter a description for the rule package.
- Template section—Select one or more rule templates. This will determine which collection of rule actions and conditions will be made available to the business rules authors who are responsible for creating rules in this package.
- Save the rule package.
The new rule package will appear in the navigation tree on the left side of the pane, displaying all the Departments and Processes underneath the package, based on the access control of the user.
Next Steps
After a rule package has been created, you can start creating business rules. For the descriptions of the various types of rules and rule objects, see the Rules Overview tab on this page.
Rule Levels and Types
In the Genesys Rules Authoring Tool, there are three levels at which business rules can be created:
- Rule Package (referred to as Global Rules)
- Department
- Process
When the appropriate node is selected on the rule package tree, you can then select the Rules tab to view or edit the rules for that level of the business structure. Rules are presented in a list, with an associated phase. The order of the rules is relevant, because they will be evaluated, within a particular phase, in the same order as they appear. You can change the order of rules by clicking the up and down buttons. The logic of a particular rule can be expressed as either a linear rule or a decision table.
Any iWD extended or custom attribute can be read or updated by business rule conditions or actions, respectively.
Global Rules
Rules that are created at the rule-package level are also known as Global Rules. Global rules enable you to specify rules that will apply to the entire iWD Solution. For example, they enable you to configure rules that classify or prioritize all tasks globally, instead of at a lower level of the business structure. Global rules are applied before any other rules.
This means that each rule phase (classification and prioritization) is triggered from within the IWDBP business process in the following sequence:
- Global rules
- Department rules
- Process rules
Capture Point Rules
You can use the rule condition Capture Point is… from the iWD Standard Rules Template, at the Global Rules level. Classification rules are not created at the Capture Point level.
Linear Rules
A linear rule is a business rule that has a set of conditions (when) and actions (then), and is used for a simple (linear) business case. For example, when a task is due in 1 to 8 hours, set the task's priority to 20.
To specify a linear rule for a simple business case:
- In Genesys Rules Authoring Tool, expand the rule package and select a node at which you want to create the rule.
- On the right side of Genesys Rules Authoring Tool panel, on the Rules tab, click New Linear Rule.
- Enter a Name for the rule that identifies it.
- Optionally, enter a Description for the rule.
- Select the Phase in which to apply the rule.
- Optionally, assign a Calendar (business calendar) to the rule.
- If required, set the Start Date and End Date.
- From the Add Condition combo box, select one or several conditions for the rule.
- By default, conditions are concatenated by using the logicalAND operator. However, you can select other functions (for example, “or” or “and not”) from the Add Condition list, and you can also select multiple conditions and use the Group (or Ungroup) functions.
- Select one or several actions for the rule from the Add Action combo box.
- To save the specified rule, click Save.
You can choose classification or prioritization.
You can optionally enter a check-in comment, which will be available later on the Audit Trail tab.
After you have created a linear rule, you can create additional linear rules or decision tables, or deploy your rule package.
Decision Tables
Decision tables have a set of the same conditions (when) and actions (then), but have different parameters and are used for a complex (structured) business case. Use decision tables to avoid dozens of linear rules in the system. Defining a decision table is similar to defining a linear rule.
To specify a decision table rule for a complex business case:
- On the Rules tab, click New Decision Table.
- Specify the rule Name, Description, Phase, Calendar, Start Date, and End Date, if required.
- From the Add Condition combo box, select zero or more conditions for the rule.
- From the Add Action' combo box, select one or more actions for the rule.
- To add a new row to the decision table, select the green plus (+) icon to the right of the right-most rule action.
- Enter the required parameters for each rule condition and action.
- Optionally, enter a Name for the row.
- To add a new row to the decision table, select the green plus (+) icon to the right of the right-most rule action. until you have set all of the required cases.
- To save the specified rule, click Save.
- Optionally, enter a check-in comment, which will be available later on the Audit Trail tab.
The result is a table in which the columns represent rule conditions and actions and the rows contain real conditions and action parameter values.
After you have created a decision table, you can create additional decision tables or linear rules, or deploy your rule package.
Business Calendars
A business calendar is a set of rules that define working days and hours, and holidays that are applicable for the business. Business calendars can be used in iWD rules to perform date and time calculations, taking into account the working schedule of the business. Business calendars can be assigned once (for example, at the Global Rule level), or can be assigned dynamically in a rule when needed.
To create new (or to manage existing) business calendars, launch the Genesys Rules Authoring Tool and expand a rule package. Select the Business Calendars entry in the tree.
List of Solution’s Business Calendar
The right side of the Genesys Rules Authoring Tool is split horizontally into two panes. The upper displays a list of a rule package's business calendars. The New Calendar button that is below this list is used to create a new business calendar. You can delete business calendars by clicking the delete button that is on the right side of the business calendar in the business calendar list. When a calendar list is selected, the lower pane displays the attributes of the selected business calendar.
Business Calendar Attributes
Business calendars consist of a set of standard mandatory attributes and optional business calendar rules. See Business Calendars in the Genesys Rules Authoring Tool Help.
Using Business Calendars in iWD Rules
After business calendars are defined, you can use them in rules. Business calendars must be assigned to a task before any business calendar-related calculations can be performed on task values. A Calendar can be assigned at the parent rule level, or to an individual rule. Only one calendar can be assigned to a task at a time, so a calendar can be assigned by one rule and then, overwritten by a later rule.
Condition/ Action |
Parameters |
Description |
---|---|---|
Assign business calendar |
{businessCalendar} |
Assigns a business calendar to a task. A business calendar must be assigned to a task, before any business calendar-related calculations can be performed on task values. A drop-down list displays a list of business calendars that are defined for the rule package. |
Is Working Day |
N/A |
Calculates whether the current date/time is a working day, according to the assigned business calendar. |
Is Working Time |
N/A |
Calculates whether the current date/time is working time, according to the assigned business calendar. |
Reprioritize after |
{period} working {periodType} |
Sets a task's re-prioritization date/time to value that is calculated, based on current date/time, the task's business calendar, and specified parameters. {period} is a numeric value, and {periodType} specifies working minutes, hours, or days. |
Task Due in |
{period} working {periodType} |
Sets a task's due date/time to a value that is calculated, based on the task's creation date/time, the task's business calendar, and specified parameters. {period} is a numeric value, and {periodType} specifies working minutes, hours, or days. |
Activate task in |
{period} working {periodType} |
Sets a task's activation date/time to a value that is calculated, based on task's creation date/time, the task's business calendar, and specified parameters. {period} is a numeric value, and {periodType} specifies working minutes, hours, or days. |
Task expires in |
{period} working {periodType} |
Sets a task's expiration date/time to a value that is calculated, based on task's creation date/time, the task's business calendar, and specified parameters. {period} is a numeric value, and {periodType} specifies working minutes, hours, or days. |
Working with the businessCalendarService object
Business calendar logic is exposed to rule expressions via the businessCalendarService object. Each method of this object accepts business calendar ID as the first parameter. Business calendar ID is usually stored in businessCalendarId attribute of the task and can be accessed from rules expressions like this:
getStringValue("IWD_businessCalendarId", $data)
businessCalendarService Method | Description | Example(s) |
---|---|---|
Date add(String businessCalendarName, Date addToThis, String type, int amount) | Adds working time to the timestamp according to the business calendar. Type parameter should be either "minutes", "hours" or "days". Amount parameter represents number of time units of the given type. It can also be negative. The method returns the resulting timestamp. When adding days, timestamp will be set to end of working day, for example when adding 1 day it will result in the end of the next working day. | businessCalendarService.add(getStringValue("IWD_businessCalendarId", $data), getDTValue("IWD_createdDateTime", $data), "hours", 4)); // get timestamp of 4 working hours after the task was created |
boolean dayIsWorkingDay(String businessCalendarName, Date day) | Returns true if the day of the given timestamp is a working day (has any working hours). | businessCalendarService.dayIsWorkingDay(getStringValue("IWD_businessCalendarId", $data), evo.common.TimeHelper.getUTCTime()); // is today a working day
businessCalendarService.dayIsWorkingDay(getStringValue("IWD_businessCalendarId",$data), getDTValue("IWD_dueDateTime",$data)); // does IWD_dueDateTime fall on a working day? |
boolean timeIsWorkingTime(String businessCalendarName, Date time) | Returns true if the given timestamp is a working time. | businessCalendarService.timeIsWorkingTime(getStringValue("IWD_businessCalendarId", $data), evo.common.TimeHelper.getUTCTime()); // is it working time right now
businessCalendarService.timeIsWorkingTime(getStringValue("IWD_businessCalendarId",$data), getDTValue("IWD_dueDateTime",$data)); // does IWD_dueDateTime fall within working hours? |
int diffWorkingDays(String businessCalendarName, Date date1, Date date2) | Returns the number of working days between two given timestamps. | businessCalendarService.diffWorkingDays(getStringValue("IWD_businessCalendarId", $data), getDTValue("IWD_createdDateTime", $data), evo.common.TimeHelper.getUTCTime()); // how many working days have passed since creation of the task? |
int diffWorkingHours(String businessCalendarName, Date date1, Date date2) | Returns the number of working hours between two given timestamps. | businessCalendarService.diffWorkingHours(getStringValue("IWD_businessCalendarId", $data), getDTValue("IWD_createdDateTime", $data), evo.common.TimeHelper.getUTCTime()); // how many working hours have passed since creation of the task? |
int diffWorkingMinutes(String businessCalendarName, Date date1, Date date2) | Returns the number of working minutes between two given timestamps | businessCalendarService.diffWorkingMinutes(getStringValue("IWD_businessCalendarId", $data), getDTValue("IWD_createdDateTime", $data), evo.common.TimeHelper.getUTCTime()); // how many working minutes have passed since creation of the task? |
Date beginningOfWorkingDay(String businessCalendarName, Date utcDate) | Returns timestamp that contains opening hours for the given date. The result will be a composite timestamp, where the date part is taken from the given parameter, but the time part contains the beginning of working hours for the given date. If date is not a working day, a null value will be returned. | businessCalendarService.beginningOfWorkingDay(getStringValue("IWD_businessCalendarId", $data), evo.common.TimeHelper.getUTCTime()); // get today's opening hours |
Date endOfWorkingDay(String businessCalendarName, Date utcDate) | Returns timestamp that contains closing hours for the given date. The result will be a composite timestamp, where the date part is taken from the given parameter, but the time part contains the ond of working hours for the given date. If date is not a working day, a null value will be returned. | businessCalendarService.endOfWorkingDay(getStringValue("IWD_businessCalendarId", $data), evo.common.TimeHelper.getUTCTime()); // get today's closing hours |
How to retrieve today's opening hours?
businessCalendarService.beginningOfWorkingDay(getStringValue("IWD_businessCalendarId", $data), evo.common.TimeHelper.getUTCTime());
How to retrieve today's closing hours?
businessCalendarService.endOfWorkingDay(getStringValue("IWD_businessCalendarId", $data), evo.common.TimeHelper.getUTCTime());
How many hours left till closing hours?
businessCalendarService.diffWorkingHours(getStringValue("IWD_businessCalendarId", $data), evo.common.TimeHelper.getUTCTime(), businessCalendarService.endOfWorkingDay(getStringValue("IWD_businessCalendarId", $data), evo.common.TimeHelper.getUTCTime()));
Rule Deployment
Once you have created all the necessary rules in a rule package, it is time to deploy the rule package to a single instance of the Genesys Rules Engine or a cluster of GREs. Once the package is deployed, it can be invoked by a client such as the iWD business process (IWDBP).
Rule package deployment is done through the Genesys Rules Authoring Tool, and is independent of the iWD Solution deployment in iWD Manager. Thus, you can deploy a new version of a rule package for an iWD Solution without having to redeploy the entire Solution.
When a rule is created or edited and it has not been deployed, there is a checkmark in the Pending Deployment column of the rule.
In addition, when a rule package requires deployment or redeployment, there will be a visual indication next to the Deploy Rules node in the Genesys Rules Authoring Tool navigation tree, under the rule package itself.
For more information about rule package deployment, including scheduled deployment and deployment history, and snapshots, see Deploying/Undeploying Rules Packages (new document).