I have this SAP B1 addon where a user can open multiple instances of a UDO from.
The form is loaded from XML.
SAPUtility.LoadFromXML(SboConnection.SboApplication, GUI.FormsPath, "SalesOrder.xml");
I have CFLs but when I open the 2nd form and select a customer on that 2nd form, the data writes to the form I opened first. I am using a user datasource for the CFLs.
oItem = _form.Items.Item("CardCode");
_cardCode = oItem.Specific;
_cCode = _form.DataSources.UserDataSources.Add("CardCode", SAPbouiCOM.BoDataType.dt_SHORT_TEXT, 50);
_cardCode.DataBind.SetBound(true, "", "CardCode");
_cardCode.Value = "";
...............................
if (oDataTable.UniqueID == "CFL_CarCod" || oDataTable.UniqueID == "CFL_CarNam")
{
if (oDataTable != null)
{
cardCode = System.Convert.ToString(oDataTable.GetValue(0, 0), null);
cardName = System.Convert.ToString(oDataTable.GetValue(1, 0), null);
}
RemoveContacts();
_cCode.ValueEx = cardCode;
_cName.ValueEx = cardName;
AddContacts();
}
In item events, I have this:
_form = SboConnection.SboApplication.Forms.Item(pVal.FormUID);
How do I fix this and make data write to the proper active form?