SAP Business One SDK – Call Custom Method from System Form Button Event

5
(1)

SAP Business One SDK – Call Custom Method from System Form Button Event

It is possible to call custom Method from System Button event. Set up your form type and event type filters appropriately. Then you’ll be able to attach an event handler to ItemEvent. When the handler fires, respond to events for the ItemUID of the system button you’re interested in. IN your event handlers you’ll typically have something like this:

//SAP Business One SDK - Call custom Method from Sytem Form Button Event

 public void SBO_Application_ItemEvent(string FormUID, ref SAPbouiCOM.ItemEvent pVal, out bool BubbleEvent)
 {
            BubbleEvent = true;
            var EventEnum = pVal.EventType;
            if ((pVal.FormType == 133 & pVal.EventType == SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED) & (pVal.ItemUID == "1") & (pVal.Before_Action == true))
            {
                CustomMethod();
            }
}

You can find the ID of the button by turning on System Information in the ‘View’ menu and hovering over the UI element. The ID and some other information are shown in the status bar.

The “Add” and “Cancel” buttons have IDs 1 and 2 in many forms.

How useful was this post?

Click on a star to rate it!

Average rating 5 / 5. Vote count: 1

No votes so far! Be the first to rate this post.

As you found this post useful...

Share this post on social media!

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?