Symptom
- How to pull data from standard EC objects (Personal Info, Job Info, Payment Info etc) to a custom MDF object on Initialize event using rule.
- Initialize rule not working/ not able to set the values.
- Initialize rule not fetching values into custom MDF object
Environment
- SAP SuccessFactors HXM Suite
- Metadata framework (MDF)
Reproducing the Issue
- Create a business rule to set the values into custom MDF portlet from standard EC object. See the KBA 2562069 to learn how to do that.
- Configure it on the Initialize event. (Configure Object Definition - > Rules -> Initialize Rules)
- Attempt to create the data for the portlet. -> The values are not being fetched/ set as per rule, fields are rather blank.
Cause
The rule executes, but does not serve this requirement in this case. The object from where the values are being fetched are pre-delivered EC objects and any data that is needed from them has to be extracted on the basis of externalCode (User) as per KBA mentioned above.
The calculation of externalCode does not happen on the Initialize event (first load up) and hence rule is not able to establish a link with EC objects.
Otherwise if you try to raise a message or set a value manually into a field (Set field = Value = ABC), it would reflect as expected. Only the fields from EC objects won't be fetched.
Resolution
To achieve this requirement, we can put the rule on "effectiveStartDate" field as an onChange rule. This field is initiated when we click on the Edit button (Pencil Icon) and hence the values will be fetched and set the moment portlet loads up for the data entry.
Note: when you create this onChange rule on the "effectiveStartDate" field and your object has Pending Data set to Yes, you may start facing an error when trying to edit one object on People Profile that has a workflow pending approval, with the following message: 'Rule [name of the rule] execution failed with error "Effective date must not be null"'. This is expected behavior and will happen when you have an workflow pending for approval and you try to insert a new record, since the rule is triggered on change of Effective Start Date. You will need to approve that workflow before being able to use the edit button and create a new record for that object.
See Also
2544336 - Custom MDF workflow and its behaviors depending on Pending Data = Yes/ No.
Keywords
Custom MDF portlets, Business rules, Initialize Rules, onLoad event, rule execution failed with error, Effective date must not be null , KBA , LOD-SF-MDF-RUL , Custom Oject based Business Rules , How To