Dynamic Code (.NET SDK)

Previous  Next |  Direct link to this topic

NB: Your SAP Partner need to have a “SAP Business One Software Development Kit” license from SAP to be allowed to use this feature. Read more here

WARNING: PLEASE BE AWARE THAT ALL SUPPORT FOR DYNAMIC CODE ARE CONSIDERED PREMIUM (PAID) SUPPORT BY BOYUM IT

With Dynamic Code developers working with the B1 Usability Package are given the option to create Universal Function functionality using the Microsoft .NET Framework.

UF Config Dynamic Code

Field

Description

Code text area

The code field allows you to write .NET code (Either C# or VB.NET) and have it executed when the Universal function is called. From the code you have access to 3 variables:

Variable

Description

company

This is a company-object (DI-API) connected to the current database. From this object you will be able to add/update Business objects.

NB: YOU SHOULD NEVER DISCONNECT THIS COMPANY OBJECT

application

This is an application-object (UI-API) connected to the current client. From this object you will be able to manipulate the client data (forms and menus).

form

This is the current form as an object. You can use it to get information about the forms data.

 

TIP: IF YOU HAVE SO MUCH CODE THAT IT CAN’T BE IN THE TEXT-AREA YOU CAN WRITE:

CODEFROMFILE(<PATH TO CODE-FILE>)

THIS WILL RESULT THAT THE RAW DATA IN THE FILE WILL BE LOADED AS THE CODE TO EXECUTE.

References

In this field you have the option to add dll-references to the code. As default the following references are already included:

-         System.dll

-         Interop.SAPbobsCOM.dll

-         Interop.SAPbouiCOM.dll

Using/Imports

In this field you can specify what usings (C#) / Imports (VB.NET) you wish to have for the code. As default the following usings/imports are already included:

-         System

-         SAPbobsCOM

-         SAPbouiCOM

Language

Here you choose the language the code written is in. You can either write C# or VB.NET code.

[%x] Variables

Here you can define the format of Dynamic Code Variables ([%0], [%1],...)

Test compile code

Pressing this button will try to compile (but not run) your code. This is handy for checking if your code can compile (does not contain syntax errors)

 

NB: you can schedule dynamic code configurations there 'application' and 'form' variables, and there doesn't contain dynamic syntax or [%x] syntax