User Process Scheduler Cannot write to DB

Using 10.2.500.40, we have a Method Directive/Pre-Processing BPM driven by User Process Scheduler than runs as expected (no error returned) but is unable to update the DB as no change happens. We made sure that the process gets fired (using “Now” schedule for now), that the expected code is being executed and that it is the correct DB being used.If we run the exact same custom code without the scheduler (as a typical BPM), it works as expected.

Only thing I can think of is the user account being used by the scheduler process doesn’t have DB-write access but maybe someone has any other idea?

thanks,

Just guessing here, but if it’s a different table than the main one, I’ve found you usually need to do the update in PostProcessing. You might need to flag it in PreProcessing (I use CallContextBpmData for that usually) then if the flag is set do the PostProcessing.

Just a guess here though :slight_smile:

1 Like

Thanks for the reply but PostProcessing was already tried without any luck.

Is the BPM enabled? Do you want to share the gist of your code?

1 Like

It is as the BPM executes all code lines:

string strCompany = callContextClient.CurrentCompany;


var qABC= from qA in Db.ABCCode
            where qA.Company == strCompany && qA.ExcludeFromCC == false
            select new {ABCCode = qA};
         
if (qABC != null)
{
  if (qABC.FirstOrDefault() != null)
  {
    qABC.FirstOrDefault().ABCCode.ExcludeFromCC = true;
    //Intentional division by 0 here returns expected error..so we know line above is executed
  }
}

thanks,

Instead of CallContexctClient, can you try Session.CompanyID?

2 Likes

Getting the same result. Even with hardcoding the value, same thing.

thanks,

Was the code above the entire thing? We usually put Db.Validate(); as the last line of BPMs that do updates. I think that is when it’s actually written out.

1 Like

Looks like that was it! Weird that never had to do this for hundreds of BPMs in the past…and that I dont need to put it for a “regular” BPM.

Thanks alot!!

It’s one of those things we noticed the Epicor consultants always did, we weren’t sure why at first, but figured there must be a reason for it :slight_smile:

2 Likes