SAP Knowledge Base Article - Public

2540872 - [Custom MDF] How to set the field values to Null by default in custom MDF portlets during Upon selecting 'Insert New Record' operation

Symptom

  • For custom MDF portlets on Employee Profile, when user clicks on "Insert New Record" button, the fields are populated with the existing values.
  • Upon selecting 'Insert New Record' on a custom MDF Portlet, the fields of the new record populate with the previous/existing records values. However the desired functionality is to have the new fields populate blank.
  • Not able to set the default values to Null while entering the New record or Editing the existing record.

*** Image/data in this KBA is from SAP internal systems, sample data, or demo systems. Any resemblance to real data is purely coincidental. ***

Environment

  • SAP SuccessFactors HCM Suite
  • Metadata Framework (MDF)

Reproducing the Issue

  1. Navigate to the custom MDF portlet on the Employee Profile or PP3 (People Profile)
  2. Click on History->Insert new Record.

    1.png
  3. Values in the fields appear from the already saved record.

    2.PNG

Cause

  • This is by design in Employee Profile and PP3. 
  • If the system has existing for older effective date and you insert new record on a date which is after that older date, then system auto populates the older value in the fields.
  • You can update those values or keep them same and save the data on new effective date.
  • However, user can set the fields in the object to populate with null values rather than having existing values using a UI rule.

Resolution

Notes: The configuration to set field values to null during timeslice insertion should only be implemented with the following constraint:
 
Only configure a field to be set to null if there are no onChange business rules attached to that particular field. Before implementing this configuration, verify that the target field is not associated with any business rules that could trigger cascading effects.

This configuration approach can lead to issues in specific scenarios involving business rule interactions. The problem occurs when the following conditions are present simultaneously:

    1. UI Rule Configuration: A UI rule is configured to set a field value to null during timeslice insertion

    2. Business Rule Attachment: The same field has an onChange business rule attached to it

    3. Cyclic Trigger Chain: The business rule's response triggers the UI rule again, creating an infinite loop

To have desired behavior, user will have to make a UI rule in the respective UI screen and configure it as onInsertUI rule.

  1. Go to Manage Configuration UI page and search for respective UI screen.

    3.png
  2. Click on Manage UI rules -> Add Rule.
  3. Create a new rule with If condition Always set to True (So that rule does not wait for any condition to be met to start executing) and set all the desired field values to Null like in below screenshot.

    Important: Please ensure to select the .Value of the field and not the field name only, neither the group in which this field is added in the UI

    4.png
  4. Click on Save and then Close
    6.png
  5. Click on Edit Properties.

    5.png
  6. Add the rule on the onInsertUI section and click on OK.

    oninsertUI.png
  7. Click on the Save button on the top.
  8. Navigate again to portlet on PP3 page and Click on History ->Insert new Record.
    Now you will see that the values in the fields load up as Blank/Null on that portlet, as desired.

    8.png

Please Note: 

  • Fields of type "Attachment" and "DateTime" cannot be set to null by default hence this rule does not work for those field types.
  • This rule will only set the field values to "Null". It will not open a new portlet with only one child record entry, if previous effective dated record has multiple child records i.e. Previous record has 3 child records. When clicking on Insert New Record button, the new portlet will have 3 empty child record entries. You can delete them if you want to add only one child record for this new date. 
  • the UI onInsertRule always runs after any side effect. Since the insert rule sets fields to null, it will clear values after each onChange event.

  • onInsert rule can execute multiple times if other onChange business rules are attached to any field, may impact the data updating. A possible workaround is to define the onInsert rule so that it does not override changes made by onChange business rules.

  • this configuration approach can lead to some issues in specific scenarios involving business rule interactions. The problem occurs when the following conditions are present simultaneously:

    1. UI Rule Configuration: A UI rule is configured to set a field value to null during timeslice insertion

    2. Business Rule Attachment: The same field has an onChange business rule attached to it

    3. Cyclic Trigger Chain: The business rule's response triggers the UI rule again, creating an infinite loop

Keywords

MDF: Metadata Framework,Custom MDF portlets,UI rules,onInitUI rule,onInsertUI rule,Insert New Record, sf , KBA , LOD-SF-MDF-UI , UI Config, Layout & Rules , LOD-SF-MDF-RUL , Custom Oject based Business Rules , How To

Product

SAP SuccessFactors HCM Core 1708