How to use custom fields and entities?
This document describes the concept of custom attributes and entities and explains how to add/remove custom attributes to a given entity. Custom attributes and entities are handled either within the apps themselves or through the Web API. In this article we will only cover usage via the Web API. Custom attributes allow new attributes to be added to system entities in order to meet a specific business need. Basic validation rules can be defined on these attributes (Required, Visible, Read Only) as well as another set of more advanced rules according to the type of data, for example, in an attribute of type ShortText besides the basic validations others can be defined such as a maximum or minimum size, the existence of invalid characters or even the application of a regular expression. All entity attributes are available through the "CorePatterns" module and the "SchemaAttributes" entity. To create a custom attribute two conditions are required: In the example above we are creating a new attribute of type text in the Parties entity of the BusinessCore module. Custom entities allow new entities to be added to the system to meet a specific business need. To these entities it is then possible to add custom attributes. All entities are available through the "CorePatterns" module and the "SchemaEntities" entity. To create a custom attribute, it is necessary to specify the value "CUSTOMENTITIES" on the attribute ModuleName In the example above we are creating a new entity to the system called "Demo".Custom Attributes
List all attributes
https://baseurl/api/AccountKey/SubscriptionKey/corepatterns/schemaAttributes/odata?$filter=IsCustomAttribute eq true
List attribute property
https://baseurl/api/AccountKey/SubscriptionKey/corepatterns/schemaAttributes/{schemaEntity}/{key}
Creating an attribute
https://baseurl/api/AccountKey/SubscriptionKey/corepatterns/schemaAttributes
BODY
{
"key":"custom_NomeFiscal",
"visible": true,
"label": "Nome Fiscal",
"isRequired": false,
"attributeType":"LongText",
"schemaEntity": "PARTIES.BUSINESSCORE"
}
Custom Entities
List all entities
https://baseurl/api/AccountKey/SubscriptionKey/corepatterns/schemaentities/extensible/odata?$filter=ModuleName eq 'CUSTOMENTITIES'
List an entity
https://baseurl/api/AccountKey/SubscriptionKey/corepatterns/schemaentities/{EntityKey}/Customentities
Creating an entity
https://baseurl/api/AccountKey/SubscriptionKey/corepatterns/schemaentities/
BODY
{
"key": "DEMO",
"title": "DEMO",
"allowExtensibility": true,
"moduleName": "CUSTOMENTITIES",
"isCompanyDependent": false,
"keyLabel": "My Entity",
"descriptionLabel": "Demo criação de entidades"
}
login para deixar a sua opinião.