Defaulting data from Standard Entities like Job Info, Comp Info etc to Custom MDF Object
I have seen a lot of requirement where the customer wants to default the standard entities value (Job Information, Compensation information etc.) to Custom MDF object. Below is the configuration to achieve this requirement.
Default the value of Job title, Standard Weekly Hours from Job Information, Hire Date from Employment Details, Is Eligible for Benefits from Compensation information and First Name from Personal Information to MDF object named cust_test_mdf.
Create a Custom MDF object and change the Data Type of ‘externalCode’ field as ‘User. Five custom fields have been created. (cust_MDFJobTitle, cust_MDFHireDate, cust_MDFStandardWeeklyHours, cust_IsEligibleforBen, cust_firstname). Make all the fields as Read Only field.
Configure a screen for this object. Navigate to Manage Configuration UI > Select Base object as MDF object you created (cust_test_MDF) > Input the ID and Save it.
Navigate to Configure People Profile > Search for ‘Live Profile MDF Information’ > Drag and Drop the block and Select the screen created in the above step.
Configure a business rule. Navigate to ‘Configure Business Rule’ > MetaData FrameWork > Click on Rules for MDF Based Objects. Input the Rule Name, Rule Id, Base Object (MDF object – cust_test_mdf), purpose as ‘Evaluate’
‘IF’ condition is always True. ‘THEN’ Condition will have fields from MDF to be equal to the field from the standard entity. Kindly note – the navigation of standard entity in the rule will be MDFobject.externalCode.StandardEntity.Field (as highlighted in Green).
The rule is attached as ‘onChange’ in Object Definition > cust_test_mdf > effectiveStartDate > Details > Attach the Rule.
To Test the rule and configuration, check users information. Below is the user’s information from my demo instance.
Job Title – HE Business Partner Saudi Arabia.
Standard Weekly Hours – 40
Hire date – Jan 01, 2013
Is Eligible for Benefit – No
First Name – Omar
Navigate to the screen which you created in People Profile and click on the Edit button (Pencil Icon)
Once you click on Edit icon, automatically the page the will load and the data from various portlets will be populated.
You can also test the same by Navigating to Manage data > New > Object Name (cust_test_mdf) > Select the user in external code field > Select the date. The fields will automatically get populated.
Thanks for sharing Dharmin.
Have you done similar one for child composite object ? Three years back I had posted in EC Enablement jam forum.
I'm looking for guidance to understand what should be done to Default value in Composite Child Instance field. The MDF implementation guide mentions the below
Initialize rules are supported for composite child entities for both UI interaction and import. The fields of composite child objects are initialized with default values.
You must execute the Initialize rules for composite child entities when they are initialized. This means that you must do the following:
1.Execute the Initialize rules for a fake composite child instance in the CompositeAssocDefVo and pass the default values to the DataGridVO.
How to initialize rule for a fake composite child instance in CompositeAssocDefVo and pass the default values to the DataGridVO ?
Answer from Luke Marson:
See the answer found in https://jam4.sapjam.com/groups/19gxOaHniue9xcOjeggAjo/documents/IPmd5hTH4HdTURX6nOzi3b:
"One can configure an Initialize Rule for composite child entity like Initialize Rule for the Payment Info Details composite object.
Basically create a rule with the concerned object as base object and attach the rule to initialize rule for the concerned object
Pls ignore the comment on CompositeAssocDefVo and DataGridVO mentioned on page 60 of the MDF handbook at https://websmp104.sap-ag.de/~sapidb/011000358700000319392014E
This is not relevant as of current and needs to be updated soon from knowledge management side .
For an example on how to configure an Initialize Rule for composite child entity pls refer to attached document at
Example on Initialize Rule for composite child entity
1. Go to Configure Object Definition -> Create 2 objects (MDFPerson with effectiveDate = BASIC and MDFAddress = FROM PARENT)
2. For MDFAddress GO -> set the label for externalName = City -> Save
3. Associate MDFAddress to MDFPerson as Composite 1:M -> Save
4. Go to Configure Business Rule -> Create a Rule with Base Object = MDFAddress . Rule : If (Always true) Then SET city = Bangalore
5. Go to Configure Object Definition Page -> Open the Child Object (MDFAddress) -> Attach the Rule to Initialize Rule
6. Go to Manage Data -> Create new MDFPerson
7. Expected Behavior > User should see the city field of child object,MDFAddress initialized with the value ‘Bangalore’
Useful solution document
Thank you Dharmin.
I understand from this description that to get the information updated in the custom MDF portlet, it has to be edited, right?
Is there a way to force the update in the custom MDF portlet immediatly when the information is changed on the standard entities?
In your example, if the job title is changed in job information, at save, is that possible to immediatly update the equivalent field in the custom MDF portlet.
Hi Marion - have you ever found a way to achieve this?
Thanks for the blog!!
Thank you, Dharmin,
Is there a way to stop adding the information to custom mdf object if job information doesn’t exist. For ex: in standard MDF based payment info object, system gives an error the moment we try to add data to payment info if job info is missing.
Dharmin Thakkar , thank you so much for the informative blog.
I tried following the blog on my custom MDF Object to have a custom cost center field auto populated from the Job Information Portlet and it is not working.
Please find below my my rule logic:
cust_AUS_Learning_Request_Form.externalCode.Job Information.Cost Centre
where exactly you assigned the rule above? I tried similar stuff this week by different blog, but pretty similar, and it was working fine.