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?
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.
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
}
}
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.