V10 ResourcesGuides
ResourcesGuides
Guides
Back | List of Articles

How to create user roles with Visual Studio?

Last changed in 02/12/2020

This document describes the steps necessary to create your first user role with Visual Studio. As the name implies, User functions (macro type) are pieces of code developed for the purpose of performing a specific operation.

Requirements

  • PRIMAVERA ERP
  • Visual Studio & .NET Framework 4.7

Step 1 - Create the project

1 - After opening Visual Studio, select File > New > Project.

2 - From the tree on the left of the displayed window select the 'C#' development language.

3 - Select the Class Library (.NET Framework) project type.

4 - Assign a name to the 'Primavera.UserFunction' project, and press OK.

Step 2 - References

1 - After creating the project it is necessary to add a reference to the extensibility platform as well as to the modules that you want to work with.

  • Primavera.Extensibility.CustomCode
  • ErpBS100
  • StdPlatBS100

Step 3 - Create the function

1 - Rename the class from Class1.cs to PrimeiraFuncao.cs

2 - Add the namespaces at the beginning of the class, using the using directive, as shown below.

3 - Next to the class name add CustomCode. This step indicates that our class will inherit all methods, properties and attributes from the CustomCode API base class, such as the PSO (platform access) and the BSO (module access).

4 - Create a public method with the Funcao1 name. Inside the created method, add the code as shown in the following image. All methods declared with the word public will be exposed in the ERP, which means that we can put the functions we need in classes.

 width=

5 - Compile your solution in BUILD > Build Solution.

6 - Register the assembly as described in "How to Register Extensibility Projects?"

7 - Register the user function as described in "How to Register a Macro User Function?"

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
Começar a Usar Como criar um projeto de integração com Visual Studio? Como criar um projeto de extensibilidade de interface (PEX) com Visual Studio? Como criar um projeto de extensibilidade de API (Motor) com Visual Studio? Como criar separadores do utilizador com Visual Studio?