View "Errors" from a BPM calling Custom DLL in Service Connect

In the Base Processing Method of Erp.KanbanReceipts.ValidateLowerLevelLotTrackedParts we have a BPM that Executes Custom Code DLL. That code requires the custom assembly to be imported in the BPM and “used”: called KanBanRecipts.dll. This DLL was added to the App server’s Assemblies folder . When this method is invoked via an Epicor Client it works. The following is the Custom C# code in the BPM. This also needs to work when triggered by a Service Connect workflow. I know SC is hitting the code because I initially forgot to add the Custom DLL in the alturanate Assembly folder. As you can see I tried added the Error to CallContextBPMData.Charater10 but I see nothing in .ValidateLowerLevelLotTrackedParts trace in Service Connect. I commented out the hard stop BLException and just left the Error in the CallContextData. I can see the Error in th Client trace logs when a regular user triggered the BPM but not when SC triggers it. As I said when I failed to import the DLL I was getting this error so I know its calling it.

“System.IO.FileNotFoundException: Could not load file or assembly ‘KanbanReceipts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null’ or one of its dependencies. The system cannot find the file specified.”

var kanbanReceipts = from row in ttKanbanReceipts where row.RowMod != "" select row;
    foreach(KanbanReceiptsRow kanbanReceipt in kanbanReceipts)
    {
        var partMtls = from row in Db.PartMtl where row.Company == kanbanReceipt.Company && row.PartNum == kanbanReceipt.PartNum && row.RevisionNum == kanbanReceipt.RevisionNum && row.AltMethod == kanbanReceipt.AltMethod select row;
        var serialNumbers = from row in ttSelectedSerialNumbers where row.PartNum == kanbanReceipt.PartNum select row;
        foreach(SelectedSerialNumbersRow serialNumber in serialNumbers)
        {
            bool mtlFound = true;
            foreach(PartMtl partMtl in partMtls)
            {
                if(partMtl.SNTopLevelAssign_c)
                {
                    mtlFound = false;
                    var serialNos = from row in Db.SerialNo where row.Company == partMtl.Company && row.PartNum == partMtl.MtlPartNum select row;
                    bool snFound = false;
                    foreach(SerialNo serialNo in serialNos)
                    {
                        if(serialNumber.SerialNumber == serialNo.SerialNumber)
                        {
                            if(serialNo.SNStatus != "INVENTORY")
                            {
                            //kanbanReceipt.ContractID  = "VLLP";
                                 //callContextBpmData.Character10 = string.Format("VLLTP:Selected Serial Number {0} is not in inventory.", serialNo.SerialNumber, "SerialNo", "SNStatus"); //MMG ADDED 1/13/2021
                                 //cMessageText= string.Format("VLLTP-EC:Selected Serial Number {0} is not in inventory.", serialNo.SerialNumber, "SerialNo", "SNStatus"); //MMG ADDED 1/13/2021
                                throw new BLException(string.Format("VLLTP-EC:Selected Serial Number {0} is not in inventory.", serialNo.SerialNumber), "SerialNo", "SNStatus");

                            }
                            var partOpr = (from row in Db.PartOpr where row.Company == partMtl.Company && row.PartNum == partMtl.PartNum && row.RevisionNum == partMtl.RevisionNum && row.AltMethod == partMtl.AltMethod && row.OprSeq == partMtl.RelatedOperation select row).FirstOrDefault();
                            if(partOpr != null)
                            {
                                var partOpDtls = from row in Db.PartOpDtl where row.Company == partOpr.Company && row.PartNum == partOpr.PartNum && row.RevisionNum == partOpr.RevisionNum && row.AltMethod == partOpr.AltMethod && row.OprSeq == partOpr.OprSeq select row;
                                bool groupFound = false;
                                foreach(PartOpDtl partOpDtl in partOpDtls)
                                {
                                    var resourceGroup = (from row in Db.ResourceGroup where row.Company == partOpDtl.Company && row.ResourceGrpID == partOpDtl.ResourceGrpID select row).FirstOrDefault();
                                    if(resourceGroup != null && resourceGroup.BackflushWhse == serialNo.WareHouseCode && resourceGroup.BackflushBinNum == serialNo.BinNum)
                                    {
                                        groupFound = true;
                                        break;
                                    }
                                }
                                if(!groupFound)
                                {
                                 //kanbanReceipt.ContractID  = "VLLP";
                                    //callContextBpmData.Character10 = string.Format("VLLTP:Serial Number {0}'s bin and warehouse don't match resource group's bin and warehouse.", serialNumber.SerialNumber, "ResourceGroup", "BackflushWhse");//MMG ADDED 1/13/2021
                                    // cMessageText = string.Format("VLLTP:Serial Number {0}'s bin and warehouse don't match resource group's bin and warehouse.", serialNumber.SerialNumber, "ResourceGroup", "BackflushWhse");//MMG ADDED 1/13/2021
                                    throw new BLException(string.Format("VLLTP-EC:Serial Number {0}'s bin and warehouse don't match resource group's bin and warehouse.", serialNumber.SerialNumber), "ResourceGroup", "BackflushWhse");

                                }
                            }
                            else
                            {
                            // kanbanReceipt.ContractID  = "VLLP";
                               // callContextBpmData.Character10 = string.Format("VLLTP:Operation not found for part material {0}.", partMtl.MtlPartNum, "PartMtl", "MtlPartNum"); //MMG ADDED 1/13/2021
                              //  cMessageText = string.Format("VLLTP:Operation not found for part material {0}.", partMtl.MtlPartNum, "PartMtl", "MtlPartNum"); //MMG ADDED 1/13/2021
                                throw new BLException(string.Format("VLLTP-EC:Operation not found for part material {0}.", partMtl.MtlPartNum), "PartMtl", "MtlPartNum");

                                
                            }
                            //serialNo.SNStatus = "CONSUMED";
                            snFound = true;
                            break;
                        }
                    }
                    if(snFound)
                    {
                        mtlFound = true;
                        break;
                    }
                }
            }
            if(!mtlFound)
            {
           //  kanbanReceipt.ContractID  = "VLLP";
             //   callContextBpmData.Character10 = string.Format("VLLTP:Selected Serial Number {0} does not match existing serial numbers.", serialNumber.SerialNumber, "SelectedSerialNumbers", "SerialNumber"); //MMG ADDED 1/13/2021
             //   cMessageText  = string.Format("VLLTP:Selected Serial Number {0} does not match existing serial numbers.", serialNumber.SerialNumber, "SelectedSerialNumbers", "SerialNumber"); //MMG ADDED 1/13/2021
                throw new BLException(string.Format("VLLTP-EC:Selected Serial Number {0} does not match existing serial numbers.", serialNumber.SerialNumber), "SelectedSerialNumbers", "SerialNumber");

            }
        }
    }
    KanbanReceiptsSvc kanbanReceiptsSvc = new KanbanReceiptsSvc(Db);
    var DS = ds;
    kanbanReceiptsSvc.ValidateLowerLevelLotTrackedParts(ref DS, dSerialNoQty, out cMessageText, out lLotTrackedMtlExist);