Approve POs from BPM

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);
      
    }
  }
 }

Just wondering if you ever managed to get the PO waiting for approval dashboard to work?

Thanks!

Paul

Unfortunately, no. The internal logic is challenging my code so far.

Too bad; I want to bring more clarity to PO’s holding for authorization, and it would be nice to approve on the spot if you have the authorization rights to do so.

Paul

I know! Management here is requesting to approve PO’s from their phone since years now! Surprised that it is not easier to do.

There are two REST calls that I think would make it fairly easy to do from a webapp for the phone:

PoAprMsgSvc to show the Approval Queue

PoSvc to do the approval.

1 Like

Thanks alot Mark. Will definitely check those eventually.

Totally agree… Getting them to go into Epicor and hunting and pecking to flip an approved switch is killing them. We do need an app for that.

1 Like