BPM Method Directive does not execute normally anymore

The below BPM code, was originally converted by Epicor when we upgraded from 9.05 to Epicor 10. It ran perfectly fine, up until recently (not exactly sure when it stopped running correctly). The BPM used to display a message when a checkbox in Part Maintenance was checked for each J
obAsmbl during the GetDetails action in Job Entry. It now only displays the message if the JobAsmbl is the Top level part or the first sub-assembly level, picture included for example (red border doesn’t display message). The BPM originally was set to Post Process on the Erp.BO.JobEntry.GetDetails but it didn’t run at all there anymore, so I moved it to Erp.BO.JobEntry.GetDetailsMsgWarning after running a Tracelog. Any assistance with getting this to drill through all the sub-assemblies again will be greatly appreciated.

jobasmbl

foreach(var Rs_JobAsm in(from row in result.JobAsmbl select row))
{
  foreach(var Rs_Part in(from row in Db.Part.With(LockHint.NoLock) where row.Company == CompanyID && row.PartNum == Rs_JobAsm.PartNum && row.CheckBox17== true select row))
  {
    this.PublishInfoMessage("INSPECTION PAPERWORK IS REQUIRED FOR PN:" + Rs_Part.PartNum.ToString(),Ice.Common.BusinessObjectMessageType.Information, Ice.Bpm.InfoMessageDisplayMode.Individual,"","");
  }
}

@CFadmin Welcome. I would assume that the dataset is only holding updated JobAsmbl records now as the product has progressed. If you look back at the Db you can get all of the assemblies. I did a couple of changes to bring only back the data needed and only do one message for all assemblies that needed paperwork.

 /* Check Part for SB17 = true */
 
 string InfoMsg = string.Empty;
 
 var partList = (from jaRow in Db.JobAsmbl
      join p in Db.Part.With(LockHint.NoLock) 
      on new {jaRow.Company, jaRow.PartNum} equals new {p.Company, p.PartNum} 
      where jaRow.Company == Session.CompanyID && jaRow.JobNum == currJobNum && jaRow.PartNum == p.PartNum && p.CheckBox14 == true
      select new {p.PartNum, p.CheckBox17}
 ).ToList();
 
 
 
 
 foreach (var partRow in partList.Where( p => p.CheckBox17 == true))
 {
  InfoMsg = InfoMsg + $"INSPECTION PAPERWORK IS REQUIRED FOR PN: {partRow.PartNum}\n";
 }
 
 if (InfoMsg != string.Empty)
{
    this.PublishInfoMessage(InfoMsg,Ice.Common.BusinessObjectMessageType.Information, Ice.Bpm.InfoMessageDisplayMode.Individual,"","");
}

1 Like

Thank you so very much. Is it possible though to have the below line only show up once at the top and just have all the part nums listed below? If not, I’ll make do :grinning:

InfoMsg = InfoMsg + $"INSPECTION PAPERWORK IS REQUIRED FOR PN: {partRow.PartNum}\n";

Again thanks for the help!!

1 Like
/* Check Part for SB17 = true */
 
 string InfoMsg = string.Empty;
 
 var partList = (from jaRow in Db.JobAsmbl
      join p in Db.Part.With(LockHint.NoLock) 
      on new {jaRow.Company, jaRow.PartNum} equals new {p.Company, p.PartNum} 
      where jaRow.Company == Session.CompanyID && jaRow.JobNum == currJobNum && jaRow.PartNum == p.PartNum && p.CheckBox14 == true
      select new {p.PartNum, p.CheckBox17}
 ).ToList();
 
  
 var partsChecked = partList.Where( p => p.CheckBox17 == true).ToList();

 if(partsChecked.Count() > 0)
 {
   InfoMsg = InfoMsg + "INSPECTION PAPERWORK IS REQUIRED FOR PN:\n";
 
  foreach (var partRow in partsChecked))
  {
    InfoMsg += InfoMsg + $"{partRow.PartNum}\n";
  }

   InfoMsg = InfoMsg.TrimEnd("\n");
 }
 
 
 if (InfoMsg != string.Empty)
{
    this.PublishInfoMessage(InfoMsg,Ice.Common.BusinessObjectMessageType.Information, Ice.Bpm.InfoMessageDisplayMode.Individual,"","");
}
1 Like

Not quite as fancy as @klincecum fix for the message, but you can also slide the header into the if condition.

/* Check Part for SB17 = true */
 
 string InfoMsg = string.Empty;
 
 var partList = (from jaRow in Db.JobAsmbl
      join p in Db.Part.With(LockHint.NoLock) 
      on new {jaRow.Company, jaRow.PartNum} equals new {p.Company, p.PartNum} 
      where jaRow.Company == Session.CompanyID && jaRow.JobNum == currJobNum && jaRow.PartNum == p.PartNum && p.CheckBox14 == true
      select new {p.PartNum, p.CheckBox17}
 ).ToList();
 
 
 
 
 foreach (var partRow in partList.Where( p => p.CheckBox17 == true))
 {
  InfoMsg = InfoMsg + $"{partRow.PartNum}\n";
 }
 
 if (InfoMsg != string.Empty)
{

    InfoMsg = "INSPECTION PAPERWORK IS REQUIRED FOR PN:\n" + InfoMsg;

    this.PublishInfoMessage(InfoMsg,Ice.Common.BusinessObjectMessageType.Information, Ice.Bpm.InfoMessageDisplayMode.Individual,"","");
}

@gpayne @klincecum Thanks for the replies guys, both worked great!

1 Like