SAP SuccessFactors Employee Central

Time Type Validations based on a separate limit for different event or leave reasons

Requirement:

In Australia we have a leave type called “Ceremonial and Cultural“ Leave which has two leave reasons. The employee needs to specify the leave reason when applying for this leave.

These leave reasons are

  • Ceremonial – Limit of 3 days per year
  • NAIDOC – Limit of 1 day per year

Configuration

Configuration is divided into two parts.

  • Custom fields
  • Rules (take rules and on Save )

Add following custom fields in the Employee Time Object Definition

Two counter fields to keep track of number absences taken per event reason. The third field is a picklist containing the two event reasons

Now coming to the main part. We will create one take rule per event reason

Ceremonial Event Reason (limit of 3 days per year)

Take Rule

Create 6 variables. The variable 3 and 3P checks if there is atleast 1 leave record with status either Pending or Approved and counter value 3 for ceremonial leave reason (ceremonial count). Similarly, there are other variables to check for counter values 2 and 1 respectively

On Save Rules

There are two on Save rules for handling Ceremonial Event Reason (attached to Employee Time Object)

  1. It saves the counter value for current leave request created based on previous counters
  2. The second onSave rule updates the counter values of existing requests in case some of the leaves has been cancelled .

For example consider the below scenario for leaves with ceremonial leave reason

Leave created on March 8 – Counter 1

Leave created on March 9 – Counter 2

Leave created on March 10 – Counter 3

Leave on March 9th is cancelled. The counter value of march 10th record should be updated to 2. This is done using Integration center job which we will see later

On Save Rule 1:

As you can see the variables are the same as in the take rule.

Coming to actual conditions

As you can see the conditions in rules are almost like the one in take rule. Just that instead of throwing an error message, we are setting up the counter value. For example, if there is already a leave record with counter value for ceremonial with 2 days, we are setting the current counter to 2+ number of days in current request. Another important to note here is the rule is processed only if Original Record is Null (Create Case), since there is a minor limitation with edit case which we discussed earlier

On Save Rule 2 :

This rule is mainly meant for updating the counter value if some of the existing absences are cancelled or declined. Refer to second example discussed above

We have similar lookups as before but just with counter value 2 and 2P, 1 and 1P

Conditions:

Similarly, we have other four conditions (with different combinations) below to check the counter value of current request and analyse if other lookups with counter values 2 or 1 are returning Null. This indicates that some leaves have been cancelled or declined .

Handling other leave reason with type NIADOC:

This is very straightforward case as limit is just 1. We do not have much complications. There is only one rule needed to track and update the counter. The below is the onSave rule

Take rule for NAIDOC

With this we are done with the rules configuration.

The final piece in this puzzle is the Integration center

Why do we need Integration Center (IC)?

If a leave in between is cancelled or declined, we would need to reset the counter of existing requests with leave reason ceremonial. The Integration center ensures that the counter values are always up to date. This can be scheduled by the customer based on desired frequency like daily, hourly, monthly etc

Let’s get to the configuration of IC (needed only for ceremonial since it has a limit of 3)

Build an Integration Center Scenario by choosing source and destination as SuccessFactors

Choose source as EmployeeTime

In the below step, “target” is also EmployeeTime. Idea is to re-run the rule regularly to see for changes done by employee. Use + button to choose the target.

Drag the External Code field from target to source. Save it.

Next add the following filters and Save

The filters are self-explanatory . We are checking for time type CCL_DEMO and with either approved or pending status and with classification as Absence (Note that even Time Sheet uses time types with attendance classification and created the employee time objects)

Finally add a sort criteria

TESTING

Create a leave on March 9th with ceremonial event reason. The counter is updated to 1

Create a leave on March 10th and 12th respectively. We have counters 2 and 3

Now cancel the leave on March 10th

We have the leave only for 9th and 12th for ceremonial reason. But the counter for 12th is 3 which is incorrect. Now run the integration center. After Integration Center has been run, the counter for march 12th leave is updated to 2.

Since counter is back to 2, the employee can now request another leave with leave reason as ceremonial. If I try to request more than 3 (including current one), I get an error

Leave a Reply

Your email address will not be published. Required fields are marked *