📚 SAP Business One SDK Help

ItemEvent Event
See Also  Example
FormUID
The unique ID of the form on which the event occurred
pVal
The object that holds the event information
BubbleEvent

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

  • True: The application handles the event after the current event handler is finished (default).
  • False: The application does not handle the event.
  • Description

    Occurs when a UI event (such as click or form load) takes place on a form in the SAP Business One application.

    Syntax

    Visual Basic
    Public Event ItemEvent( _
       ByVal FormUID As String, _
       ByVal pVal As ItemEvent, _
       ByRef BubbleEvent As Boolean _
    )

    Parameters

    FormUID
    The unique ID of the form on which the event occurred
    pVal
    The object that holds the event information
    BubbleEvent

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

  • True: The application handles the event after the current event handler is finished (default).
  • False: The application does not handle the event.
  • Remarks

    Managing events of user forms and items is essential because there is no business logic behind them. On SAP Business One forms and items, you can add your own process to the SAP Business One process on specific events and even replace the standard event handling with your own process (the BubbleEvent parameter should be set to false).  

    Example

    Catching form data events (C#)Copy Code
        void SBO_Application_FormDataEvent(ref SAPbouiCOM.BusinessObjectInfo BusinessObjectInfo, out bool BubbleEvent) 
        { 
            BubbleEvent = true; 
            if(BusinessObjectInfo.BeforeAction) 
            { 
                //Do something 
            } 
            else 
            { 
                //Test new property on IBuinessObject interface (BusinessObject.UniqueId)  
                SAPbouiCOM.Form form = SBO_Application.Forms.Item(BusinessObjectInfo.FormUID); 
     
                SAPbouiCOM.BusinessObject bisObj = form.BusinessObject; 
     
                String uid = bisObj.Key; 
     
                if(BusinessObjectInfo.Type == "2") 
                { 
                    //Test DI method GetByKeys using key recived from UI (IBusinessObjectInfo.UniqueId) 
                    //suppose you have a DI Company Objcet 
                    SAPbobsCOM.BusinessPartners BP1 = oDICompany.GetBusinessObject(BoObjectTypes.oBusinessPartners) as                              
                                                                         SAPbobsCOM.BusinessPartners; 
                    BP1.Browser.GetByKeys(BusinessObjectInfo.ObjectKey); 
          
                    String cardCode = BP1.CardCode; 
                } 
          
                //Test DI method to get Service Data Interface using key recieved from UI  
                if(BusinessObjectInfo.Type = "80") 
                { 
                    CompanyService companyService = oDICompany.GetCompanyService() as CompanyService; 
                    AlertTemplateService serv = companyService.GetBusinessService(ServiceTypes.AlertTemplateService);  
                    AlertTemplateParams alrParam; 
                    //alrParam = serv.GetDataInterface(AlertTemplateServiceDataInterfaces.atsdiAlertTemplateParams)  
                    alrParam = serv.GetDataInterfaceFromXMLString(BusinessObjectInfo.ObjectKey); 
                    AlertTemplate alt = serv.GetAlertTemplate(alrParam); 
                    Int32 code = alt.Code; 
                    String name = alt.Name; 
                } 
             } 
         } 

    See Also