Using Business Rules in SuccessFactors Recruiting Management
In this post, I’ll detail how to implement Business Rules functionality in SuccessFactors Recruiting Management module. Customers and Consultants who are familiar with SuccessFactors Employee Central or MDF objects would have used Business Rules in some form. Business Rules provide us with a way to add application logic to determine the outcome of a change made to particular data in the system. A Business Rule in its simplest form looks like “If this data is changed in a specific way, then the system should respond in this way”. Business Rules are created in the Rules Engine tool and the system executes these rules during run-time at configured event triggers.
Till Q3 2017 release, various SuccessFactors modules and features have used the Rules Engine and one module that used Business Rules widely is SF Employee Central. Starting from Q3 2017 (or b1708) it is made possible to use Business Rules in SF Recruiting Management module. In general, Business Rules are configured to address legal regulations, company policies or other business specific needs. Business Rules can be used
- to trigger specific workflows
- to default values
- to validate data entry
- to calculate values
- to propagate data from other fields/tables
- to raise warnings or errors and so on
As the requirements vary from customer to customer and are company-specific, and depend on how the customer has set up the system the business rules are highly configurable.
Especially in SF Recruiting Management, the two objects that support Business Rules are 1. Job Requisition, 2. Job Offer Approval
In this article, we’ll first see the components of a Business Rule, then pre-requisites to use business rules in SF Recruiting Management, followed by how to configure a Business Rule for fields on the Job Requisition Template or Offer Approval Template and finally Rule Events available.
1. Components of a Business Rule:
A Rule consists of Basic Information, Parameters, and the actual Rule statements
Basic Information: This section includes metadata such as Rule Name, Rule ID, Start Date, Rule Type, Description
Parameters: Select an object that the rule is based on. The Base Object determines which fields we can select when creating the rule. Base Object is the first parameter and additional parameters can be added after creating the rule. In Recruiting Management, the base object can be
- Job Requisition (All) or an individual Job Requisition Template
- Offer Approval (All) or an individual Offer Approval Template
Note: Only “active” templates are available to select as the Base Object.
The rule will be applicable to all active Requisition templates if Job Requisition (All) is the base object. Job Requisition (All) combines all the template fields into one view, whereas if an individual template is selected then only those fields on the respective template are available for rule definition. Same is the case with Offer Approval (All) or an individual Offer Approval template.
Rule Statements: They include
IF Statement – Only one IF Statement is supported per rule but you can add multiple conditions to one IF Statement using AND or OR operators. If the rule is to be triggered unconditionally, then select Always True checkbox.
THEN Statement – This section defines how the system should react and is executed only if the conditions in the IF Statement evaluate to True. You can add several THEN statements per rule
ELSE Statement – This section defines how the system should react if the IF section evaluates to False. You can add several ELSE statements per rule
ELSE IF Statement – This works similar as IF section and you can add multiple ELSE IF statements per rule.
2. Prerequisites to use Business Rules in SF RCM:
Login to Provisioning. Turn on “Enable Generic Objects” and “Enable Recruiting Business Rules”.
Login to SF instance. For RBP customers, in the Admin Center > Manage Permission Roles > select the Admin role > Metadata Framework > select all the permissions and Save Changes.
For NON-RBP customers, navigate to Administrative Privilege > Metadata Framework > select all the permissions and Save Changes.
Note: Business Rules may work without RBP, but the SF Platform team always recommends enabling RBP to use Business Rules.
3. How to configure a Business Rule:
There are 2 steps in configuring Recruiting Management Business Rules.
Step 1 – Create a configurable rule:
- From the Admin Center, navigate to Company Settings > Configure Business Rules
- In the Configure Business Rules screen, click Create New Rule button
- Select Basic for New Rule: Select a Scenario as Recruiting currently only supports Basic rule type
- Fill in the information on the right side such as Rule Name, Rule ID, Start Date, Base Object and click Continue. Base Object can be a Job Requisition or Offer Approval template
- Add any IF, THEN, ELSE or ELSE IF statements as required, and save the rule
This rule means that when the Job Type field value changes to “Director”, then the Options Pack field will be set to Yes and Stock field will be set to 10,000.
Step 2 – Assign the rule to a specific field or template
The second step is to assign the rule created to a field on the corresponding template. To assign the rule, follow the process below.
- Download the appropriate Job Requisition template(s). Since the base object on this rule is Job Requisition (All), the rule must be added to each individual job requisition template
- Open the template(s) in an XML editor
- Since the IF condition is defined on Job Type field changes, you need to assign the rule to the Job Type field with event “onChange” in the Job Requisition template(s) as highlighted below
Refer to Rule Events section in this article for more information about available events
- Save the template(s) and upload to Provisioning
- System executes the rule during runtime when the IF condition evaluates to True
Note: The ability to make rule related changes in Manage Templates admin tool will be available in future releases.
4. Rule Events:
Rule Events define which user action in the system triggers rule execution. Between Step 1 and Step 2 in configuring a Business Rule, you need to decide what kind of event will trigger the rule. In Recruiting Management, a business rule can be triggered under one of the following rule event types:
- onInit of Job Requisition or Job Offer Approval
- onSave of Job Requisition or Job Offer Approval
- onChange of Job Requisition or Job Offer Approval
The conditions under which different event types are used and the syntax to define them are explained below.
- Use onInit event to set fields to default values that should be shown as soon as the page opens
- It is NOT possible to raise messages with onInit event
- For Job Requisitions, onInit event is executed only on the Requisition – Short Req Page and the following fields can be set to default values on the Requisition – Short Req Page
- Internal Job Title
- Due Date
- Operators (Hiring Manager Name, Recruiter Name etc.) that are available on the page
- onInit event is only supported for Copy Existing Job Requisition, Browse “Families & Roles”, Create New Job Requisition From Blank Template actions
- onInit event is NOT supported for Duplicate Job Requisition on the requisition dashboard or Create a new job requisition from Position actions
- For Offer Approvals, onInit event is executed when an Offer is created by selecting an Offer Detail Template from the dropdown or when an Approved or Declined Offer is edited by clicking on Edit Offer Detail button
- onInit rules are always associated at a template level so any onInit rules should be declared immediately before the closing tag </job-req-template> or </offer-detail-template> in the appropriate template.
- Syntax: <trigger-rule event=”onInit” rule=” Test_Rule”/>
- Example: see Figure 6
Base Object for this rule is Offer Approval (All) and it defaults the Contract End Date, Target Bonus Amount, Sign On Bonus Amount, and Total Compensation fields when the Offer is created or edited.
- Use onSave event for post processing of data when the “Save” button is clicked on the UI
- It is NOT possible to raise messages with onSave event
- For Job Requisitions, onSave event is executed via the following ways
- on click of Save button in the Job Requisition details page
- on click of Send to Next Step button or link
- on click of Next button from Job Requisition Short page
- For Offer Approvals, onSave event is executed via the following ways
- on click of Save button. onSave event will be executed even if the Offer Detail form has validation errors (except for missing approver error)
- on click of Send for Approval button
- onSave rules are always associated at a template level so any onSave rules should be declared immediately before the closing tag </job-req-template> or </offer-detail-template> in the appropriate template.
- Syntax: <trigger-rule event=”onSave” rule=”Test_Rule”/>
- Example: see Figure 7
Base object for this rule is Job Requisition (All) and it auto calculates Bonus value on click of Save button on the Requisition detail page.
- onChange event is triggered as soon as the user makes a change to a Requisition or Offer Approval field on the UI
- It is possible to raise messages (warnings or errors) based on the data entered by the user
- onChange rules are always associated at a field level so any onChange rules should be declared within the field definition section immediately before the </field-definition> closing tag in the appropriate template.
<field-definition id=”title” type=”text” required=”true” custom=”false”>
<field-description> <![CDATA[Position Title]]> </field-description>
<trigger-rule event=”onChange” rule=”Test_Rule”/>
- Examples: see Figure 8 and Figure 9
Base object for this rule is Job Requisition (All) and when the Hiring Manager value is entered on the Requisition detail page, the Division, Department, and Location fields are defaulted with values from the Hiring Manager’s Job Information.
With onChange event, you can raise messages so that users will receive additional information in case the rule condition is or isn’t met.
Base object for this Business Rule to raise message is Job Requisition (All). If a user attempts to change the currency while the Base Salary and Bonus have already been specified in a job requisition, a warning message will be shown.
Note: The actual message is created in the Manage Data tool under Message Definition category.
- Employee Central module is NOT required to use Business Rules in SF Recruiting Management module.
- Rule Event names are case sensitive. For example, onChange is different from onchange.
- Business Rules can also be executed via a Scheduled job or OData API.
- Using the Business Rule Execution Log admin tool, you can analyze any errors and figure out exactly what went wrong.
- The rules are executed in the order in which they are declared on the template. It could happen the output of one rule is overridden by the execution of the rule following it. So, make sure that the rules are ordered properly to get the right results.
- You can now use business rules to automatically post job requisitions, either immediately or at a predetermined time in the future. The job requisition status must be Approved and not yet been posted.
The sample rules used in the post are SuccessFactors standard examples.