V10 ResourcesReference
ResourcesReference
Reference
Back | List of Articles

Characteristics of entities and services

Last changed in 02/12/2020

In the PRIMAVERA ERP, entities and services have a set of transversal characteristics that implement uniform behaviors, influencing the way entities are treated or services respond.

The main characteristics of entities and services are described below.

Unique identifier

All entities that support transactions (Purchase, Sales or Accounting Documents, etc.) in the system have a unique identifier automatically generated by the platform. This is a GUID (Global Unique Identifier). The identifier must be used in API services that support the selection of a record by its ID.

Example of how to generate an ID with the platform:

PSO.FuncoesGlobais.CriaGuid(false);

Example of editing a record by ID.

BSO.Vendas.DocumentosVenda.EditaID('C73C6FD7-61E4-4DCA-B441-32C3DD94A336');

In edit mode

The EmModoEdicao attribute is present in all system entities and is used by the platform to know when to update or create a record in the database. When using the Edita or EditaID method, this attribute is automatically set to true.

User Fields

The CamposUtil attribute (StdBECampos) allows access to the collection of user fields of the entity. These fields represent extra entity characteristics and are used to store additional data specific to an implementation.
VndBELinhaDocumentoVenda linha = new VndBELinhaDocumentoVenda();
double qtd = Convert.ToDouble(item.SubItems[1].Text);

// Add a row to the sales document.
PSO.Vendas.Documentos.AdicionaLinha(invoice, item.SubItems[0].Text, ref qtd);

// Retrieve the first row from the document.
linha = invoice.Linhas.GetEdita(1);

// Assign the value to the 'LinVar1' CDU in the first row of the invoice.
linha.CamposUtil['CDU_LinVar1'].Valor = '100';

Standard services

All classes provide a set of standard services that allow you to perform a set of operations on the entities.

AttributeDescription
ActualizaAdd or update a new entity
ActualizaValorAtributo Update the value of an attribute for an existing entity
ActualizaValorAtributosUpdate the value of several attributes for an existing entity
DaValorAtributoReturns the value of an attribute for an existing entity without locking the record
DaValorAtributosReturns the value of several attributes for an existing entity without locking the record
DaValorAtributoLockReturns the value of an attribute for an existing entity and locks the record
DaValorAtributosLockReturns the value of several attributes for an existing entity and locks the record
EditaReturns an existing entity
ExisteChecks whether a specific entity exists
RemoveRemoves an entity from the system (as applicable)
ValidaActualizacaoChecks whether an entity can be updated
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
Características das entidades e serviços Conceito de integração Conceito de extensibilidade Como registar projetos de extensibilidade? Boas práticas de organização de projetos de integração