Custom fields
It is possible to add fields of your own, called custom fields, to some of our API resources. Typical cases are custom fields for customers, opportunities or products.
Adding a new custom field
Even though it is possible to create custom fields by using our API resources for custom fields, it is probably easier to just use our REX applications to perform that task. If you wanted to add a field, say Color, to the API resources for products, follow these simple steps:
- Navigate to the REX application CUSTOMFIELDS in the RamBase client (www.rambase.net)
- In the upper left corner, choose which object you want to add a custom field to. In this case it would be Product.
- Click the button Add custom field and type in a name and choose a datatype.
In this case it would be "Color" with the datatype of String. - Add a description to the field
- Consider adding domain values to the field, by checking Only allow predefined values and then clicking Setup predefined values to add domain values. In this case we would add two fields: One with key "ORANGE" and description "Orange", and one with key "DARKBLUE" and description "Dark blue"
- Activate the custom field by choosing the context menu item called Activate.
The status of the custom field should now be 4 which indicates that the field is active and ready to be used.
Getting and setting custom field values
When one ore more custom fields have been added to the object, it is possible to use these fields in GET-, PUT- and POST-requests. Simply set the query parameter &$showcustomfields to True. It is also possible to filter by custom fields in GET resources for lists. They are always found under the element CustomFields located at the end of the API resource.
The API request above would give the following result:
Here is an example of filtering by the custom field:
Removing a custom field
Use the menu item Delete custom field to completely remove a custom field. Note that it is not possible to delete a custom field if one or more object has specified a value for that field. It is, however, still possible to use the menu item Deactivate custom field which changes the status from 4 to 9 and removes the field from the API resources. When deactivated, no data is lost and it is possible to reactivate the field later.