Hi, we’re trying to build an updatable dashboard listing POs waiting for actions where our users could use on their mobile to approve/reject POs (having multiple approval levels). I have a Pre-Processing BPM (Update Method) on an updatable BAQ firing when we Accept or Reject from the dashboard (the BPM code was based from this topic).
Everything seems to be working as expected except when saving the dashboard returns the error “You must Accept or Reject the PO.”. However, when refreshing, the record gets away as expected (and data in DB seems all fine). BPM code below. Anything not looking right? Im not sure of CheckBeforeUpdate() as Im not sure what parameters to pass. Thanks in advance.
string ViolationMsg = "";
string str1 = "";
string str2 = "";
string str3 = "";
if (ttResults != null)
{
if (ttResults.FirstOrDefault() != null)
{
intPONum = ttResults.FirstOrDefault().POApvMsg_PONum;
var POApproveSwitchDataSet = new Erp.Tablesets.POTableset();
Erp.Contracts.POSvcContract hPOApproveHandle = null;
if (hPOApproveHandle == null)
{
hPOApproveHandle = Ice.Assemblies.ServiceRenderer.GetService<Erp.Contracts.POSvcContract>(Db);
}
POApproveSwitchDataSet = hPOApproveHandle.GetByID(intPONum);
if (POApproveSwitchDataSet != null)
{
POApproveSwitchDataSet.POHeader[0].RowMod="U";
if (ttResults.FirstOrDefault().POApvMsg_MobilePOApproval_c.ToLower() == "accept")
{
hPOApproveHandle.ChangeApproveSwitch(true, out ViolationMsg, ref POApproveSwitchDataSet);
}
else
{
hPOApproveHandle.ChangeApproveSwitch(false, out ViolationMsg, ref POApproveSwitchDataSet);
}
hPOApproveHandle.CheckBeforeUpdate(out str1, out str2, out str3, "PORel", POApproveSwitchDataSet);
hPOApproveHandle.Update(ref POApproveSwitchDataSet);
}
}
}