Symptom
- How to create a custom field for a MDF Object?
- How do I customize a MDF object?
- How to add a new field in MDF objects?
- Is it possible to customize MDF objects?
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 HXM Suite
- Metadata Framework (MDF)
- SAP SucessFactors Employee Central
Resolution
SuccessFactors Metadata Framework allows you to customize objects and to extend the functionality of features/modules that are built using it.
For example, you can extend existing Employee Central and Succession entities by adding new fields and defining business rules. This article explains how to create fields for existing MDF Objects.
- Go to Admin Center > Company Settings > Configure Object Definitions.
- In the first dropdown, select “Object Definition” and in the second, select the object you want to modify. For example, you might choose to add fields to the “Position” object.
- In the top-right corner, click Take Action > Make Correction.
- Scroll to the bottom of the list of Fields and you should see “cust_” in the last text box.
- In this box, you can type the field’s Name, which will be the unique identifier for the field in that given object. The Name should not have any spaces.
After typing the field name, press “Tab”. You’ll see that the name will have the “cust_” prefix, which is expected for all custom fields. - Then, you can also specify the “Maximum Length” for the field and the “Data Type”. See an explanation for the available data types below:
Data Type
Description
String
Used for text input fields. MDF allows storing text up to 4K long.
Number
Used to store positive integers. Allowed characters are 0-9.
Displayed based on the user's locale settings, such as using a comma or decimal point as the decimal separator.
Auto Number
Used to store numbered lists.
Decimal
Used to store decimal numbers.
Displayed based on the user's locale settings, such as using a comma or decimal point as the decimal separator.
Boolean
The two allowed values are Yes and No.
Date
Used to store a date from a date picker.
Picklist
Used to restrict the field value from a picklist.
Translatable
Used to allow the entry of localized strings for different locales.
Data Source
This field must not be used by end users. It can be used in Java object definitions to specify a class implementing data source interface to provide a set of custom code defined autocomplete values.
Generic Object
Used to reference a generic object. When the object is created, this field shows a value help with a list of the instances of that generic object.
Foundation Object
Used to reference a foundation object. When the object is created, this field shows a value help with a list of the instances of that foundation object.
User
Used to reference a user object. When the object is created, this field shows a value help with a list of active users. This does not support Employee Central based effective-dated user search, that is, it will not filter the list of users based on effective dates.
DateTime
Used to store the date and time information related to a time zone. This is a more granular data type. Time is converted to the time zone of the user who views or requests the export, and not to that of the user who originally entered the time.
Time
Allows the user to enter times without having to specify any time zone information.
Times are generally displayed in HH:mm:ss format and are validated to ensure that a valid time value is entered. However, multiple formats are allowed based on the settings in the object definition, for example, hideSeconds and TwelveHourFormat.
- If you click on “Details”, you have additional options to configure the field.
Those options are explained in the below table:
Field
Description
Valid Values Source
This field needs to be set for the following field types:
- Picklist: ID of the picklist.
- Generic Object: Object ID of the generic object you want to reference.
- Foundation Object: Object ID of the foundation object you want to reference.
- Enum: Fully qualified class name of the Java enum for this data type.
Hide Old Value
Effective dated objects have a history view. In the history view, records for different start-dates are shown. A strikethrough is shown to indicate the previous value of the field. If you do not want to see the strikethrough for the field, set Hide Old Value to Yes.
Decimal Precision
Decimal precision for a decimal data type.
Include Inactive Users
Set to Yes if you want to display data for inactive users, along with that of active users. Default value is No.
UI Field Renderer
Use this field to define the label that appears in dropdown menus when selecting a picklist or generic object value in Manage Data. If this field is defined, external code is hidden in these menus.
Transient
Set to Yes to make the field transient. Values of transient field are not stored in the database, but are populated at runtime in the user interface, based on rules or associations.
For example, you can use transient fields to display simple calculations at runtime, such as an age or a number of days remaining or days since a particular date. You can also use transient field to display different text labels based on certain rules, such as an indication of whether a given pay component is shown as a percentage or an amount.
Help Text
Set this translatable text for the field. You can give instructions for the user.
Private or Sensitive Information
Set to Yes or No.Note
If you set this to Yes, then the value saved on that field will be visible as '***'. For example, a password field for any login page.
If you set this to No, then it behaves like all the other fields.
Show Trailing Zeros
Set to Yes or No.Note
If you set this to Yes, then it will show trailing zero for decimal precision. For example, for a decimal field, set the decimal precision to 4, enter value for the field as 12 and save. The value then appears as 12.0000
Default Value
You can set a default value for the field.
When a default value is selected for a field, it will initialize the new page with the given value. For example, if you set the default value for a STRING field as ABC, when you go to Manage Data page to create a new object, then you will see ABC already listed in that field.
Hide Seconds
Set to Yes or No.
If you set this to Yes for a field with the Time data type, then it hides the seconds for the time display.
NOTE:This property is only applicable for Time data type and will be ignored for other data types including DateTime.
Required
Set to Yes if the field is required.
Visibility
Set to one of the following:
- Editable: Field is visible and editable.
- Read Only: Field is visible and read only.
- Not Visible: Field is inactive and will not appear in UI, API, imports/exports, and so on.
Status
This is a read-only field with the value Active or Inactive. Inactive fields are not available in the system. You cannot use them in import, UI, OData, rules, and so on. If you do not enable the corresponding module, fields become inactive automatically. Note that you cannot make the fields inactive from the UI.
Label
Set this translatable label for the field. The default value for this is the field name. To enter a translated label name, click the translations button.
Cascade
Set to one of the following:
- No Selection: User will see the field as read only on the Business Configuration UI page.
- None: User will see the field as read only on the Business Configuration UI page.
- Save
User will be able to edit the field on the Business Configuration UI page.
Inactivated By
If this object is dependent on another object, select the object from the list.
Rules
Select the rule to associate with updating the field. You can also create a new rule to select by using the + button.
Field Criteria
Set this to restrict the possible values for the field by specifying the following:
- Source Field Name: Field whose values restrict the possible values for the field that you are defining.
- Destination Field Value: Name of the field whose value is being restricted. This is the name of the field that you are defining.
For example, you can restrict choices of dates based on an effective start date, or you can restrict choices such as countries, time zones, and so on, by location.
- defaultDestinationValue: You can create a default destination in cases where the destination field value is not set. Currently it only stores constant values.
You can add or delete field criteria by clicking the corresponding icon.
condition
Enter the field ID.
conditionValues
You can enter a list of values that makes the condition true. Make sure that you enter the values correctly because there are no system validations for this.
- Then, you can click on “Save” and the custom field will be created.
NOTE: When the field you are referring to is a picklist, it will not be possible to have the default value empty. You may try to add only spaces in the 'Default Value' of the picklist field, but it won't count as a valid data. This is an expected behavior.
Q: Is there a possibility to have rating stars for a custom field?
A: This is currently not supported.
See Also
- Implementing the Metadata Framework (MDF)
- 2955912 - [Custom MDF] Unable to add more custom fields inside a Custom MDF object definition
Keywords
MDF, Metadata Framework, create custom field, object, foundation, position, data type, object definition, default value, , KBA , LOD-SF-MDF-OBJ , Object Definition & Field Related Issues , LOD-SF-EC , Employee Central , LOD-SF-SCM , Succession Management , Problem