I am using a method directive (pre-processing) on LaborSubmit. I want to make the user scan the part number to verify. Easy peasy so far BUT…
What’s the best\proper way to halt the submission in the BPM? I thought I’d be tricky and place Terminate on Error and then do something stupid like divide by 0 but something tells me there’s a more sound approach.
The code (where Char01 is PN field from BPM Data Form):
if(callContextBpmData.Character01.ToUpper() != JobResult.JobHead.FirstOrDefault().PartNum.ToUpper())
{
throw new Ice.BLException("Error: Part does not match this Job!");
return;
}
I realize the return is both unneeded and unreached... it just makes me feel better
un-related, but that’s a very heavy call just to get JobHead, write a linq query to get it instead of invoking a BO.
Either way I would move my check somewhere else, this call may not be one you can successfully halt. What gets called after this ? or before in the trace?
On failed confirmation:
SubmitForApproval is just recalled
I attempted to move the BPM to Labor.Update but I have to figure out how to get it call only in certain instances. It’s currently being called even when a new record is created.
String PART;
var part = (from jobs in Db.JobHead
where jobs.JobNum == ttLaborDtl.FirstOrDefault().JobNum
select jobs.PartNum);
{
if(callContextBpmData.Character01.ToUpper() != part.FirstOrDefault().ToUpper())
{
throw new Ice.BLException("Error: Part does not match this Job!");
}
}