Hi SDK Developers,
Since the Id sSalesOpportunities_Id Opportunity Sales, how do I tie the activity (oContacts object) to the Sales Opportunity? In the end, the field oContacts.ParentId = sSalesOpportunities_Id, but can not perform the update, because the field is read-only ParentId.
private void SBO_Application_DataEvent(ref SAPbouiCOM.BusinessObjectInfo pVal, out bool BubbleEvent)
{
BubbleEvent = true;
if ((pVal.FormTypeEx == "651" & pVal.EventType == SAPbouiCOM.BoEventTypes.et_FORM_DATA_ADD) & (pVal.BeforeAction == false))
{
// Begin Update
SAPbouiCOM.Form oFormAtividades = SBO_Application.Forms.Item(pVal.FormUID);
SAPbouiCOM.BusinessObject oBusinessObject = oFormAtividades.BusinessObject;
string sUId = oBusinessObject.Key;
SAPbobsCOM.Contacts oContacts;
oContacts = (SAPbobsCOM.Contacts)oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oContacts);
oContacts.Browser.GetByKeys(sUId);
//oContacts.ParentId = sSalesOpportunities_Id; // impossible -> read-only
if (oContacts.Update() == 0)
SBO_Application.MessageBox("Update contact Ok.");
else
SBO_Application.MessageBox("Update contact does not exist.");
// End Update
}