BPM Runs for only one user

,

Created a BPM using custom code to update the GL Control Code based on the currency selected on the header tab. The BPM runs Post Processing on APInvoice.UpdateMaster.

The custom code runs fine for the user account that created the BPM. But does not run for any other user.

Code displayed below:

Erp.Tables.EntityGLC EntityGLC = null;

foreach (var MyInvoices in (from ThisInvoice in ttAPInvHed where
  ThisInvoice.CurrencyCode == "USD"
  select ThisInvoice))
  
  {
  int iInvoice;
  int.TryParse(MyInvoices.InvoiceNum,out iInvoice);
  
  int iVendNum;
  int.TryParse(MyInvoices.VendorNum.ToString(),out iVendNum);
  
  
  using (var txScope = IceContext.CreateDefaultTransactionScope())
  
  {  
    foreach (var MyGLCntl in (from ThisGLCntl in Db.EntityGLC.With(LockHint.UpdLock) where
      ThisGLCntl.Company == Session.CompanyID &&
      ThisGLCntl.Key2 == iInvoice.ToString() &&
      ThisGLCntl.Key1 == iVendNum.ToString()
      select ThisGLCntl))
      
      {
        MyGLCntl.GLControlCode = "APUSDGSS";
      }
      
      Db.Validate();
      txScope.Complete();
      
   }
   }

Can you be more specific on “Doesn’t run”. Does it just not fire at all? Is there an error?

Does not appear to fire at all. No errors.
Not sure if there’s a way I can trace it to see if the BPM fires.

The easiest way it to pop up message boxes.

Otherwise you can set up server side tracing with this.

Is that the extent of your BPM? Just a single Exec Custom Code widget with just the code you posted above?

Yup…that’s it.

You might need that code in the Update() method as well.

You can enable a client trace to see if UpdateMaster fires for that user.
Or you could push a message on the info message stack at the very start of your custom code:

InfoMessage.Publish("Enter APInvoice.UpdateMaster Post MyMethod");

Either of these would verify if this directive fires for the user in question. If it does fire, you should add in more debugging to see where it falls down. Maybe this other user does not have rights to update a GLControlCode?