SAP Knowledge Base Article - Public

2705895 - Using the function Get Count Of Dependents in business rules

Symptom

**all the images from this document are from our internal test environments, any resemblance with real environments are mere coincidence.**

You want to configure a business rule to get the count of dependents for one specific employee which will be used in a validation.

By doing a research in out Business Rules Implementation Guide you were able to find the function called "Get Count Of Dependents()" but this function does not seems to work.

Environment

SAP SuccessFactors Employee Central (EC) - All Versions

Resolution

To use this function you must add 4 parameters being 3 option and one mandatory (relationship type).

KB1.jpg

Below you can see the list of parameters and which value they expect:

  1. Person ID External: This is the ID of the user whom the dependents are related which means the ID of the Employee;
  2. User ID : In some cases the user ID might be different from person ID External so here you need to inform the userID of the employee whom the dependents are related;
  3. As On Date: Here you need to inform the effective date you want the function to check if there is dependents active;
  4. Relationship Type: here you add the relation ship type be there is an important note here. You must add the External Code for the relationship type according to your picklist "personRelationshipType";

Here you have an example how this rule can be configured:

KB2.jpg

KB3.jpg

This function will only retrieves the count of the dependents which are already saved in the database so the dependent you are saving will not be considered see the detailed explanation below:

  1. The dependents session of the employee is empty;
  2. You start adding a new dependent and save it;
  3. This business rule is configured as onSave in the dependent portlet so it will be triggered and the result for this function will be 0 because at this moment no dependents exists in the database yet;
  4. You come back to the employee and add a second dependent with the same type;
  5. When you save, the rule is executed again and this time the result will be 1 because you have the dependent added in the steps 2-3;

Scenario example:

You want to create a business rule which will validate if the employee is adding a second dependent with the type spouse, if this happens then it should trigger an error message.

Before explaining this scenario is important to explain that it will not be supported to have an onSave rule for this purpose because it triggers individually for each record of dependents added so you need to create a warning message and add this as an onChange rule in the field relationship-type.

Rule example:

KB5.jpg

Note that in the example above the relationship type instead of having a fixed value, has a dynamic value retrieving the external code from the current value of the dependent so you have this option as well.

Keywords

KBA , LOD-SF-EC-RUL , Business Rules & Event Derivation , How To

Product

SAP SuccessFactors Learning 1808