Skip to Content
0
Dec 31, 2022 at 04:36 PM

Why does the DataFormEvent works only on the Client-Account who fires the event?

68 Views

Hello together,

in my Add-On I use a DataFormEvent whenever a new Activity added.

So whenever a user adds a new Activity an action should be done.

The action should be a reload a Grid Data so I can directly know whenever a new Activity has been added without needing to press on a Refresh Button for example.

It works fine but only when the user that adds the Activity is the same User that has the Form open where the Grid, which must be reloaded,is.

Now, I need it this Event to work to every user who has the same Add-on on and has that Form open, where the Grid is.

All Users have the same Add-On so why this Event is fired only by the user who add the activtiy and not to all of them?

Here is my Code for that Event :

Application.SBO_Application.FormDataEvent += new SAPbouiCOM._IApplicationEvents_FormDataEventEventHandler(FormDataEvent);

and the ForDataEvent Methode is :

 static void FormDataEvent(ref SAPbouiCOM.BusinessObjectInfo BusinessObjectInfo, out bool BubbleEvent)
        {
            BubbleEvent = true;

            if (BusinessObjectInfo.BeforeAction == true && BusinessObjectInfo.Type == "33" && BusinessObjectInfo.EventType == SAPbouiCOM.BoEventTypes.et_FORM_DATA_ADD)
            {
                Application.SBO_Application.MessageBox("Data is not added yet. ActionSuccess is " + BusinessObjectInfo.ActionSuccess + "");

            }

            if (BusinessObjectInfo.BeforeAction == false && BusinessObjectInfo.Type == "33" && BusinessObjectInfo.EventType == SAPbouiCOM.BoEventTypes.et_FORM_DATA_ADD)
            {
                string Key = BusinessObjectInfo.ObjectKey.ToString();

                SAPbobsCOM.Contacts oBP = (SAPbobsCOM.Contacts)Program.oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oContacts);

                oBP.Browser.GetByKeys(Key);
                string CardName = oBP.CardCode;
                Application.SBO_Application.MessageBox(CardName);
            }
        }

Any Suggestions how could this be done in the right way?

PS: I use VS2015 and this Methode is the Class where the Form with that Grid is.