02-26-2014 07:14 AM
When an opportunity is deleted, the salesprocess and salesprocessaudit records remains...
In order to solve it:
OnBeforeDelete Event - Post Execute Step
//Deleting SalesProcesses
IBusinessRuleHelperService service = new BusinessRuleHelper();
using(NHibernate.ISession _session = new Sage.Platform.Orm.SessionScopeWrapper()){
System.Collections.IList spId = _session.CreateSQLQuery("SELECT SALESPROCESSESID FROM SALESPROCESSES WHERE ENTITYID='"+opportunity.Id.ToString()+"'").List();
foreach(var item in spId)
{
service.DeleteRecords(string.Format("SALESPROCESSID = '{0}'", item.ToString()), "SALESPROCESSAUDIT");
}
service.DeleteRecords(string.Format("ENTITYID = '{0}'", opportunity.Id.ToString()), "SALESPROCESSES");
}
Enjoy!
02-28-2014 11:36 AM
Thank you Manuel. I have logged defect 14095132 for the web client. I did verify the network client is properly removing the entries from the those tables.