Microsoft Dynamics GP 2015 added Service Based Architecture (SBA) and .Net Interop functionality to the application. Service Based Architecture allows the Dexterity developer to write global procedures and use meta data to expose these service enabled procedures to the outside world as REST Web Services.
GP Power Tools provides five Service Enabled Procedures which can be used to execute custom business logic created in the Runtime Execute window. These services can be called as Web Services, from Visual Studio Tools using Visual C# or Visual Basic.Net, or from any Dexterity product dictionary using sanScript.
The functions provided by the custom service enabled procedures are controlled by the contents of the Runtime Execute Script ID identified in the URI or first parameter when the procedure was called.
Using the Runtime Execute window you can select one of the five procedures as a custom script purpose, this will populate the script with the template code needed to pass the parameters between the service enabled procedure and the Runtime Execute script.
To provide a flexible multi-purpose parameter format that can work for all version of Dynamics GP, the parameters in and out are passed using the Text datatype. Each line of the Text parameter can be used to represent a separate data field.
The template code populated, when you choose one of the service enabled procedures as a custom script purpose, provides example code using the Customer Master table.
- ServiceCreateCustom – Create a new record
- ServiceDeleteCustom – Delete a record
- ServiceGetCustom – Retrieve a record
- ServiceUpdateCustom – Update an existing record
- ServicePostCustom – Perform any additional function (the demo code does maths)
The screenshot below shows the Runtime Execute window with the ServiceDeleteCustom template code. The template code retrieves the Customer ID to be deleted from the first line of the text parameter and then executes the code to locate and remove the record, returning any error codes as the status.
While the base language for the Runtime Execute window is Dexterity sanScript, you have the option of using Helper Functions to call SQL Execute (T-SQL) scripts, or .Net Execute (Visual C# or Visual Basic.Net) scripts.
In summary, this means that GP Power Tools provides custom web services which can be coded in any combination of Dexterity sanScript, SQL Transact-SQL, Visual C# or Visual Basic.Net.
The possibilities are endless.
This article was originally posted on http://www.winthropdc.com/blog.