Skip to content

Migrating scripts to the new method signature

José Maia edited this page Oct 25, 2016 · 2 revisions

From version 1.200.56 onwards, the platform added UI extensibility via C#, and consequently, scripts that execute in the connector received a new possible syntax that users should switch over to.

This syntax means:

  • The node.js extensibility website is no longer necessary, as extensibility scripts can communicate directly with the connector;

  • The automatically generated extensibility scripts are no longer necessary, but any remote query scripts (used in External Entities) should include the logic that these old scripts performed: paging, filtering the query (by date, where conditions, security filters, etc.).

    We include an example of a valid remote query for an SQL server and for a Primavera ERP in this repository. In order to develop your own solution, for different systems, your logic should be implemented in the executeQuery(ContextData context, Entity document, string query) method, and made to return a QueryResult object, like these scripts do.

  • In the case of the other connector scripts, the change is only to adapt the script to utilize the new signature for the Execute method, ScriptResponse Execute(ContextData context, Entity document, Dictionary<string, object> parameters).

  • In both cases, the logic to access the external system's parameters is different. Previously, some parameters were accessed as context.Company where others were accessed as context.Parameters["Foo"]. The syntax we recommend is to identify the desired external system first, with an operation such as var externalSystem = context.ExternalSystems.FirstOrDefault().Value; object, and then access all of its parameters by externalSystem.Parameters["Foo"]. Important: Remember to deal with null values when obtaining the externalSystem!

Clone this wiki locally