📚 SAP Business One SDK Help

InvokeMethod Method
See Also  Example
pIInvokeParams
A string to be used by InvokeMethod method as needed and defined by the InvokeMethod method, which you create.
pIGeneralData

A row in the database table that is linked to this GeneralService instance. You can obtain a GeneralData object for a specific row, for example, by calling the GetByParams method.

Any changes to the CSboBusinessObject in the DLL's InvokeMethod does not affect the data in the GeneralData object that is passed. When control returns to your add-on from the DLL, the data in the GeneralData object is unchanged. This can cause a situation where the data in the GeneralData object is not up to date.

Description

Executes the InvokeMethod method of your UDO's custom business implementation DLL. 

The InvokeMethod has the following signature:

    TCHAR* InvokeMethod(CSboBusinessObject * refObj, const TCHAR* sInput)

The CSboBusinessObject object receives data from the GeneralData parameter of this method, which represents a record of this UDO.

The TCHAR object receives the string from the InvokeParams parameter of this method. You can use the InvokeMethod method as a dispatcher to other methods in your DLL, and use this string to determine how to dispatch to other functions in the DLL.

Syntax

Visual Basic
Public Function InvokeMethod( _
   ByVal pIInvokeParams As InvokeParams, _
   ByVal pIGeneralData As GeneralData _
) As InvokeParams

Parameters

pIInvokeParams
A string to be used by InvokeMethod method as needed and defined by the InvokeMethod method, which you create.
pIGeneralData

A row in the database table that is linked to this GeneralService instance. You can obtain a GeneralData object for a specific row, for example, by calling the GetByParams method.

Any changes to the CSboBusinessObject in the DLL's InvokeMethod does not affect the data in the GeneralData object that is passed. When control returns to your add-on from the DLL, the data in the GeneralData object is unchanged. This can cause a situation where the data in the GeneralData object is not up to date.

Return Type

A string returned from the DLL's InvokeMethod.

Example

You can invoke a custom method written in an implementation DLL for your UDO.
Invoking a custom UDO method (C#)Copy Code
SAPbobsCOM.GeneralService oGeneralService; 
SAPbobsCOM.GeneralData oGeneralData; 
SAPbobsCOM.InvokeParams oInvokeInput; 
SAPbobsCOM.InvokeParams oInvokeOutput; 
 
// Get GeneralService 
oGeneralService = cConnection.Instance.DICompanyService.GetGeneralService(UDOID); 
 
// Get data interface 
oGeneralData = (GeneralData)oGeneralService.GetDataInterface(GeneralServiceDataInterfaces.gsGeneralData); 
oInvokeInput = (InvokeParams)oGeneralService.GetDataInterface(GeneralServiceDataInterfaces.gsInvokeParams); 
 
oInvokeInput.Value = InvokeInputString; 
 
// Use invoke method 
oInvokeOutput = oGeneralService.InvokeMethod(oInvokeInput, oGeneralData); 

See Also