Rules and Picklists in the SuccessFactors Metadata Framework
Following up on my recent blog Extending SuccessFactors with the Metadata Framework, I wanted to delve a little deeper into the Rules Engine that forms part of the SuccessFactors Metadata Framework (MDF) and also look at Picklists. Both of these form an integral part of data validations, approvals, and business logic that is used within the SuccessFactors system and, in particular, Employee Central.
Rules Engine
As mentioned in my blog on the MDF, it provides a flexible and consistent framework for customers and consultants to extend the object model of SuccessFactors and add their own unique rules, validations, and business logic to SuccessFactors. Rules can be used where user exits, BAdIs, or ABAP program Enhancement points would be used in SAP HCM to provide customer-specific business logic or validation of data input.
The Rules Engine allows you to create rules by modeling statements and flow logic to define the business logic of the rule. Rules have two sets of logic that is configured in the MDF: If logic and Then logic.
If logic uses statements “and” and “or” statements to determine if the Then logic should occur. Each of these statements involves checking a field for a particular value or object attribute. If logic can also be set to Always True, which means that the Then logic automatically executes when the rule is triggered. An example can be seen in the screenshot below, along with Then logic.
The Then logic determines either the value to be set and/or the message to be raised if the If logic conditions are met. When the Set Output Type is selected then a value will be set to the field that is configured, either from a selected value or an object attribute.
Hooks
Once a rule has been created, it can be assigned to one or more Hooks. Hooks are points at which Rules can be triggered and can be either at the object level or the field level.
At the object level Rules can be added at four points of the object “lifecycle”:
- Initialization
- Validation (pre-save)
- Saving
- Deleting
At each point one or more rules can be defined. They will be triggered once the object gets to that point of its maintenance.
Within the object level rules can be added at field level. Here one or more rules can be defined so that they will be triggered when a field is modified.
Picklists
Picklists are, simply, selection lists used to populate a data input field with one of a number of predefined values. They act in the same way as F4 Helps in SAP HCM. Picklists provided in the standard system can be altered to use customer-specific values. The screenshot below shows a simple example of a Picklist for Marital Status.
Picklists are configured using the option Manage Configure Generic Object Definition under Company Settings in OneAdmin or under Generic Objects in the old Admin Tools. Below shows a Picklist being created for the different types of documents that you can contribute on SCN.
This Picklist can then be assigned to a field in the MDF as below. You can also see the Rules section to define one or more rules at the field level.
Summary
When combined, the Rules Engine and Picklists provide customers to add their own business logic, rules, and validations to objects and fields. This means that customers can have a significant level of control on ensuring that data is created, maintained, and deleted the way that they need it. It also means that data quality can be upheld by using the system to validate data entry or provide users with picklists from which to select values.
The MDF is covered in detail in the SAP PRESS title SuccessFactors with SAP ERP HCM.
Luke, if one reads through the MDF documentation they would have to flip through 20 pages to get the information you provide in this well-structured blog. Great follow-up to your MDF blog.
Cheers,
Jyoti
Thanks Jyoti. I know which document you are referring too and I only read it after I'd written the blog. I'm expecting it to be enhanced over the coming months as the MDF gets rolled out. My blog may become obsolete in that case though š
Best regards,
Luke
Seems as the cloud systems face an ever wider range of real world requirements they gain in complexity and then it takes an SAP on-premise trained and battle hardened consultant like Luke to cut through the jungle š
I think the key to the SaaS is getting what SaaS means as a delivery method for HR services. It's not just on-premise technology hosted in the Cloud. The aim for consultants who transition is to understand both on-premise and Cloud.
Nice article. Keep them coming!
Thanks Christopher!
Readers of this blog might enjoy this article if they have an SAPexperts subscription:
Creating Metadata Framework Objects in SuccessFactors Employee Central
Hi Luke,
Thanks for sharing nice overview on rules and picklist. I am trying to create a custom rule using manage data link but "Rule type" field is blank while I create a custom rule.
Based on rule engine Handbook ( section 3.3 ) I followed mentioned steps to create a rule type.
1. Company Processes & Cycles portlet, -> Company Settings -> Configure Object Definitions.
2. Click Search: Picklist and select RuleType (RuleType) from the dropdown list.
However I could not find any predefined picklist so I created custom picklist "RuleType".
After I created a picklist to for rule type I still can not find my custom rule type in "RuleType" dropdown from the dropdown list.
Is there something I am missing while creating a rule type? I have checked permission and I have all the permission to create a rule.
Thanks
Abhay
Hi Abhay,
You need to create the Rule Type picklist as per the handbook. It seems like you might have done that. However, make sure you have set the effective date of your RuleType picklist to 1/1/1900.
All the best,
Luke
Hi Luke,
I appreciate the simplicity of this blog and it's always easy to comprehend. I'm currently looking for any expression within the rule to extract the last 4 characters of a string.
I have built the custom field WBS in MDF alternate cost distribution, the requirement is when saving the record I have to check if the cost centre value is equal to last 4 characters of WBS string. Kindly share your thoughts.
Regards
Prasanna Manikandan
Hi Prasanna,
See Girish's response to your question on his blog:
Employee Central | Business Rules Engine at work
Best,
Luke
My Question - i have a picklist of numbers which once selected from the dropdown will be used to do some calculations. Somehow the calculations are not correct when i do it thru picklist but If i manually input a number in the field, the calculation is correct. Any ideas please?
Picklist is stored as text, so you would need to use a function to convert the datatype to number within your rule
Luke - You are awesome. Still need to figure out how to convert the picklist string to number but THANKS A LOT.
Hi Luke, How can we change the datatype thru a rule? Thanks
You can use the ToNumber() function
Hi Luke,
Thanks for another great article. I'm wondering if you can help me; do you know how I modify the 'AddressType' picklist? The implementation guide states that for this picklist, the external code needs to be referenced in the data model; do you know if there are any further notes I can find around this?
Many thanks for your help!
AddressType is not an MDF Picklist, so you change it by downloading the picklist file in Admin Center in Company Settings > Picklist Management
Hi Luke,
thanks for this nice acritical, i have one question
can i add authorization on the pick list level, for example i have pick list include 3 options (A,B,C), each option will open other fields, but all the fields for the 3 options on the same portlet, the business requirements is to give separate access for each group of fields according to pick list options, so is this doable somehow ?
This is not possible. You might need to create 3 different fields with different picklists.
Hi Luke,
I have a question.. How can a picklist can be created through csv. what is the procedure to follow, i am aware of the picklist management in MDF but i get stacked up when i try to create a Picklist through csv, Xml. Please advice.
Thank in advance.
Hi Lokesh,
Download the CSV template, fill it in, then upload it. Make sure to save it as a CSV file with the right encoding so you don't lose formatting.
Best regards,
Luke
Hi Luke,
I have two questions.Ā With a picklist, is it possible to hide the key value?Ā So what we see is Stop Pay Statement Print (Stop) where Stop is the picklist key.Ā The other question I have is can you default a value to a field such as setting the effective date to the system date?
Thanks for all your help!
Hi Margaret,
On some objects (typically Generic Objects) you can remove the key, but that is not universal across SF.
Yes, you can default field values using business rules.
Luke Marson
Hi Luke,
Good Day !!!
Is it possible to create a rule based on picklist? Following is my requirement . achieved worker type and employee type now based on worker type employee it should populate me these 3 fields as picklist . Based on embedded or non embedded it should show me following drop down ...
This scenario
may be possible with two different fields but i doubt about picklist based business rule. Kindly help
Thanks
Bindu
Hi Bindu,
I don't quite follow what you are trying to achieve here. Can you elaborate?
You can create rules that query picklist values, but it's not possible to generate a picklist with a business rule.
Best regards,
Luke
Hi Luke,
Hope you doing great !!!
My client wants to narrow down the search based on one picklistĀ like if i check worker type as embedded contractor it should show me agency supplied and framework supplied and not others.
Client wants that to happenĀ Please help.
Thanks
Bindu
Hi Bindu,
When you say "the search", what exactly are you referring to? And which picklists are you referring to?
Best regards,
Luke
Hi Luke,
Sorry i should have told picklist thing earlier. So yeah i want one child picklist value to be linked to two parent picklist ids.
I want framework supplied ( child picklist ) to be available to embedded and non-embedded contractors ( parent picklsit) so how to achieve it via cascading picklist . If i create two different child entities it will becomeĀ 2 different code and when client is pulling a report it will reflect incorrectly.
Thanks
Bindu
Hi Bindu,
I'm still trying to understand exactly what you are trying to achieve, but it does seem like what you are trying to achieve can be done with the standard parent-child picklist functionality. However, if you provide some detail about what you are doing I can possibly confirm it.
Best regards,
Luke
Hi Luke,
Good Day!!!
I am able to achieve requirement partially via parent -child relationship.
Say Agency supplied is part of both non-embedded and embedded contractors.
so, when i select employee as worker type not only types of employees available in the picklist appear but also agency supplied and framework supplied is visible as they cannot be related to one parent. So, when i select employee i should see only employee, expat and temporary and not agency or framework
Expat
Temporary placements
Agency supplied
Framework supplied
Agency supplied
Vetted visitor
Thanks
Bindu
Hi Bindu,
Would it work to add "agency" and "framework" twice, with one set of values with parent of "Embedded Contractor" and one pair with parent of "Non-Embedded Contractor"?
Best regards,
Luke
Hi Luke,
I got that thought. but if we pull report then we need to give both parent and child entity so that we get clear stastics.
Tried building up business rule but it is not working .
Thanks
Bindu