V10 ResourcesReference
ResourcesReference
Reference
Back | List of Articles

How to create employees using the API?

Last changed in 12/08/2020

The Human Resources module of PRIMAVERA ERP includes several features that allow you to manage your organization's human resources processes with greater speed and efficiency, such as salary processing, integration with social security or payment and receipts management.

In this article we will explore the V10 API using the example of creating an employee. This will enable your organization to create or update employee data through external applications.

Employee Files

Among all the options available in the module, the main Human Resources entity is the employee table, where you can access employee files. This table is used in many of the existing processes and includes the configurations used in most of the module.

Example of creating an employee:

Note: For this demonstration, we use the project available in GitHub.

Step 1 - Add the reference to the Human Resources module

Create a project in Visual Studio and add the references to the Human Resources API:

  • RhpBE100
  • IRhpBS100

Step 2 - Use the "RhpBE100" namespace

To make it easier to read the code, add the API's HR namespace.

using RhpBE100;

Step 3 - Create the employee object with the required information

Use the method for creating the "employee" object and define the required fields.

RhpBEFuncionario employee = new RhpBEFuncionario
{
Funcionario = txtID.Text,
Nome = txtName.Text,
DataAdmissao = dtHireDate.Value,
Situacao = txtSituation.Text,
Instrumento = txtWorkPolicy.Text,
Estabelecimento = txtWorkLocation.Text,
SegurancaSocial = txtSocialSec.Text,
};

Step 4 - Check if it is a new record

Use the 'EmModoEdicao' property to define the type of record to be made. If this value is "true", the employee table will receive an "Update", otherwise the operation will be an "Insert".

To fill this property, use the employee code entered in "txtID.Text" to validate through the Human Resources API if the employee already exists.

Employee.EmModoEdicao = PriEngine.Engine.RecursosHumanos.Funcionarios.Existe(txtID.Text)

Step 5 - Register the employee

Use the "Actualiza" method to make changes to the database and create/update the employee, according to the value defined in the "EmModoEdicao" property.

PriEngine.Engine.RecursosHumanos.Funcionarios.Actualiza(employee);
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