UserFieldsMD is a business object that enables you to manage user-defined fields in user and system tables.
This object enables you to:
- Add a user-defined field.
- Retrieve a user-defined field from the database by its key.
- Remove a user-defined field.
- Save the object in XML format.
Source table: CUFD
Mandatory properties: Name and TableName
IMPORTANT: After creating a new user-defined field in .NET, you must release the object by executing the following line of code, where myObject is a reference to the UserFieldsMD object:
System.Runtime.InteropServices.Marshal.ReleaseComObject(myObject);
The DI API allows only one metadata object instance (with no other instances of any object type). This maintains data integrity by preventing any manipulation of a business object while modifying the object's properties.
If you add a mandatory user-defined field, you must also define a default value; otherwise, the following message appears: "Invalid object name; cannot add field".
Note: After adding a user-defined field, you can view it in the User-Defined Fields - Management window. To view the new user-defined field in the Settings window, you must restart the SAP Business One application.
Before adding a user-defined field, check the application window and make sure there is an entry for the object to which you want to add a user-defined field.
To display the form in the application:
- From the main menu bar, select Tools --> Customization Tools --> User-Defined Fields - Management.


~167.gif)

~167.gif)





