Cloud Jasmin DevelopmentGuides
DevelopmentGuides
Guides
Back | List of Articles

How to use custom fields and entities?

Last changed in 29/08/2022

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

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.

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

To create a custom attribute two conditions are required:

  • Choose the entity where it will be created, which can be a system entity or a custom entity;
  • Add the prefix "custom_" to the attribute name.custom_
https://baseurl/api/AccountKey/SubscriptionKey/corepatterns/schemaAttributes

BODY
{
    "key":"custom_NomeFiscal",
    "visible": true,
    "label": "Nome Fiscal",
    "isRequired": false,
    "attributeType":"LongText",
    "schemaEntity": "PARTIES.BUSINESSCORE"
}

In the example above we are creating a new attribute of type text in the Parties entity of the BusinessCore module.

Custom Entities

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.

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

To create a custom attribute, it is necessary to specify the value "CUSTOMENTITIES" on the attribute ModuleName 

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"
}

In the example above we are creating a new entity to the system called "Demo".

Bookmark or share this article
Esta página foi útil?
Obrigado pelo seu voto.

login para deixar a sua opinião.

Obrigado pelo seu feedback. Iremos analisá-lo para continuarmos a melhorar!
Artigos Relacionados
Boas práticas de integração Como utilizar OData para obter uma lista de encomendas? Como executar queries OData sobre os dados? Actualización de los endpoints de las integraciones [ES] Códigos de estado das respostas