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 reviewing our Business Rules Implementation Guide, you were able to find the "Get Count Of Dependents()" function, but this function does not seems to work as expected.
Environment
SAP SuccessFactors Employee Central (EC) - All Versions
Resolution
To use this function you must add 4 parameters, 3 being optional and one being mandatory (relationship type).
Below you can see the list of parameters and which value they expect:
- Person ID External: This is the ID of the user whom the dependents are related which means the ID of the Employee;
- 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;
- As On Date: Here you need to inform the effective date you want the function to check if there is dependents active;
- Relationship Type: here you add the relationship type - note that 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:
This function will only retrieve 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:
- The dependents session of the employee is empty;
- You start adding a new dependent and save it;
- 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;
- You come back to the employee and add a second dependent with the same type;
- 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:
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.
Please also note that the 'Get Count Of Dependents' function can have issues with special characters - for example, if your 'Relationship Type' external code has special characters (e.g. an external code of 'personRelationship~@6') then the count may fail due to these special characters not being able to be parsed correctly. As such, the relationship types should have simple external codes (e.g. '2') without any special characters.
Keywords
dependent, count, dependent count, business, rule, business rule, get, of, get count of dependent, get count of dependent(), function, , KBA , LOD-SF-EC-DPD , Dependents Management , LOD-SF-EC-PER-PRS , Personal Info - Config, Rules, RBP, UI , How To
SAP Knowledge Base Article - Public