📚 SAP Business One SDK Help

FormDataEvent Event
See Also  Example
BusinessObjectInfo
The object that holds the event information
BubbleEvent

Indicates how the application handles the event. Relevant only when BusinessObjectInfo.BeforeAction is true.

  • True: The application performs the form action (default).
  • False: The application does not perform the form action.
  • Description

    Occurs when the application performs the following actions on forms connected to business objects:

    • Add
    • Update
    • Delete
    • Load form data via browse, link button, or find

    The event provides the unique ID (BusinessObjectInfo.ObjectKey) of the modified business object. Use this as an input object to the DI API DataBrowser.GetByKeys method to get a DI object.

    Note: You can also use this feature in the UDO new default forms with the header-line style.

    Syntax

    Visual Basic
    Public Event FormDataEvent( _
       ByVal BusinessObjectInfo As BusinessObjectInfo, _
       ByRef BubbleEvent As Boolean _
    )

    Parameters

    BusinessObjectInfo
    The object that holds the event information
    BubbleEvent

    Indicates how the application handles the event. Relevant only when BusinessObjectInfo.BeforeAction is true.

  • True: The application performs the form action (default).
  • False: The application does not perform the form action.
  • Remarks

    The event occurs only for forms connected to a business object.

    The application does not send this event when the business object is modified by another application, DI action, or add-on action.

    The BusinessObjectInfo.ObjectKey property returns an empty value in the following cases:

    • Business objects that are not exposed in the DI API.
    • In the before notification of the Add action (et_FORM_DATA_ADD).
    • In the before notification of the Load action (et_FORM_DATA_LOAD) triggered by a Find operation.

    Example

    Catching UDO Form Data Events (C#)Copy Code
    // Using the Data event 
    void B1Application_FormDataEvent(ref SAPbouiCOM.BusinessObjectInfo BusinessObjectInfo, out bool BubbleEvent) 

        BubbleEvent = true; 
        if(BusinessObjectInfo.BeforeAction) 
        { 
            String key1 = BusinessObjectInfo.ObjectKey; 
            // The String contains XML with the key, also in UDOs 
            MessageBox.Show("Key Information in before event: " + key1); 
        } 
        else 
        { 
            String key2 = BusinessObjectInfo.ObjectKey; 
            // The String contains XML with the key, also in UDOs 
            MessageBox.Show("Key Information in after event: " + key2); 
        } 

    Catching form data events (C#)Copy Code
    Private WithEvents SBO_Application As SAPbouiCOM.Application 
    Private Sub SBO_Application_FormDataEvent( ByRef BusinessObjectInfo As SAPbouiCOM. BusinessObjectInfo , ByRef BubbleEvent As Boolean) Handles SBO_Application.FormDataEvent 
        If (BusinessObjectInfo .BeforeAction = True) Then ‘Before Event 
        'Do something 
        Else 'After event 
     
        'Test new property on IBuinessObject interface (BusinessObject.UniqueId) 
        Dim form As SAPbouiCOM.Form = SBO_Application.Forms.Item(BusinessObjectInfo.FormUID) 
        Dim bisObj As SAPbouiCOM.BusinessObject = form.BusinessObject 
        Dim uid As String = bisObj.Key 
     
            If (BusinessObjectInfo.Type = "2") Then 
     
            'Test DI method GetByKeys using key recived from UI (IBusinessObjectInfo.UniqueId) 
                Dim BP1 As SAPbobsCOM.BusinessPartners = DI.GetBusinessObject(BoObjectTypes.oBusinessPartners) 
                        BP1.Browser.GetByKeys(BusinessObjectInfo.ObjectKey) 
     
                Dim cardCode As String = BP1.CardCode 
            End If 
     
            'Test DI method to get Service Data Interface using key recieved from UI 
            If (BusinessObjectInfo.Type = "80") Then 
                Dim CompanyService As CompanyService = DI.GetCompanyService() 
                Dim serv As AlertTemplateService = CompanyService.GetBusinessService(ServiceTypes.AlertTemplateService) 
                Dim alrParam As AlertTemplateParams 
                'alrParam = serv.GetDataInterface(AlertTemplateServiceDataInterfaces.atsdiAlertTemplateParams) 
                alrParam = serv.GetDataInterfaceFromXMLString(BusinessObjectInfo.ObjectKey) 
                Dim alt As AlertTemplate = serv.GetAlertTemplate(alrParam) 
                Dim code As Integer = alt.Code 
                Dim name As String = alt.Name 
            End If

    See Also