In this blog, I will show how two unique requirements in Recruiting can easily be met using the Rules Engine.
First let’s look at populating a read-only field.
Populating Read-only Fields
The most common use case is salary calculation for offer approval – you want to be able to calculate the salary components based on either a manual input of a value or based on a combination of grade, location, etc.
While the calculation itself can be easily achieved using a set of rules, customers commonly ask that recruiters not be able to change the values populated by the rules. This means the fields that store the values of the salary components would be read-only.
By now, you might have experienced that populating read-only fields is not possible using onChange rules. However, it is possible using onSave rules.
I have use the requisition template for these examples but they’ll hold equally good on the offer approval template.
Here’s how to do it:
1. Mark fields as read-only – costcenterId in this case
2. Create the rule
3. Assign the rule to the requisition template
4. Execute scenario
There, however, still a limitation to this approach – if the salary calculation must happen on the manual input of a value, that field, of course, cannot be read-only. Therefore, an onSave rule won’t work in this scenario.
Let’s now look at the other scenario.
Forcing Limits on Field Values
You want the user to be able to input a value but don’t want him/ her to exceed a certain value or specify lesser. Here’s where things become interesting – you can use rules to check if the value respects the threshold value but can’t enforce it. The most you can do is raise a warning or error message, which, in case of Recruiting, still allow you to continue saving in spite of the message flag.
When I was brooding over this scenario with our ever helpful Pradyumna S Harish (Product Manager, Recruiting), he gave a brilliant idea. He said,”Shyamu, what if you can use rules to set the field value to NULL if the input doesn’t respect the threshold?”. That was it!
We combined an error message with this condition in the rule and it addressed this requirement completely!
You can also use this approach to prevent a user from proceeding in various scenarios:
- If a field value is not within the threshold range (covered in this blog)
- If a field value is not equal to the reference value (from a picklist, for example)
Here’s how to configure:
1. Make the base field mandatory
If its not mandatory, the user might completely skip inserting a value and this rule won’t get triggered. The “required” flag takes care that the field isn’t empty, so you don’t need another rule to check that.
2. Create a message to be popped up when the threshold is breached
3. Create a rule to:
- Check the input value against the threshold
- Output the error message when the threshold is breached
- Set the field value to NULL when the threshold is breached
4. Assign the rule to the requisition