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