BPM Warning on Job Receipt to Inventory - Help Needed

I am attempting to create a method directive on ReceiptsFromMFG as a preprocess that will flag the user entering the transaction qty if the trans qty + previous qtys > Job Production Qty.

I need assistance creating a sum for previous transactions.

Thanks for the help!

I have thus far came up with the following custom code that should do exactly what I’m after:

foreach (var PartTran_iterator in (from r in ttPartTran where r.Added() || r.Updated() select r))
{
  if(PartTran_iterator!=null)
  {
    decimal QtyReceived = 0;
    decimal ProdQty = 0;
    
    var Job = (from s in Db.JobHead where s.Company == Session.CompanyID && s.JobNum == PartTran_iterator.JobNum select s).FirstOrDefault();
    if (Job != null)
    {
      ProdQty = Job.ProdQty;
       
      foreach (var PartTran2_iterator in (from v in Db.PartTran where v.Company == Session.CompanyID && v.JobNum == Job.ToString() && v.TranType == "MFG-STK" select v))
      {
        QtyReceived = QtyReceived + PartTran2_iterator.TranQty;
      }
        
      if((QtyReceived + PartTran_iterator.TranQty) > ProdQty)
      {
        asdf = 1;
      }
    }
  }
}

Credit Here:

However, when I go to receive the job to inventory I get the following message:

image

I am unsure as to why I am receiving this message and would like some assistance troubleshooting. Additionally, I would like the custom code to prompt the user for a yes or no to a continue anyway ststement. Has anyone accomplished this before?

Ended up axing most of the code and instead opted to get only the transaction history through the second for each statement.

Now I need to come up with a way of having an ok and a cancel button on the bpm form. Anyone know a quick way to get that setup?

Hi Dylan,

Here are some screenshots to help get you moving:

Nancy

1 Like

That seemed to do the trick. Next question I have is how do I get call context passed over to the form?

Ended up just making another custom code module to assign scalar values to the call context there and added in the call context to the message on the form.

Thanks for the help Nancy! Credit to you.

1 Like

Dylan,

I was wondering if you would be willing to share the code that you ended up with on the BPM Warning on Job Receipts?