Method Directive on Capable To Promise - Intercompany PO Automation

Hi again!

So, I was able to use Method Directives to create\approve POs for Quick Job Entry but having a little trouble getting the BPM to fire correctly with jobs created using Capable To Promise.

I believe I have 2 issues going on. The first is identifying the rows created by CTP correctly and secondly is automating the POs when there is multiple lines. I’m not a programmer by trade so don’t beat me up too hard.

Let’s start with the first issue; the condition and Linq statement. My condition is a query, if number of rows is more or equal to 1. I can’t use Job Number to link the CTP tables to the Job tables as the CTP job number is returned as “CTP123456789”, but the final resulting job number, what I’m looking for, is “123456-x-x”. So I’m going by order number instead.

In my code, this is how I’m trying to grab my job operation data:

foreach (var ttCapPromise_iterator in (from ttCapPromise_Row in ttCapPromise
                                    select ttCapPromise_Row))
{
    var ttCapPromiseRow = ttCapPromise_iterator;
    JobProd = (from JobProd_Row in Db.JobProd
               where string.Compare(JobProd_Row.Company, ttCapPromiseRow.Company, true) == 0
               && JobProd_Row.OrderNum == ttCapPromiseRow.OrderNum
               select JobProd_Row).FirstOrDefault();
               
if(JobProd == null)
{


this.PublishInfoMessage("No job production information", Ice.Common.BusinessObjectMessageType.Information, Ice.Bpm.InfoMessageDisplayMode.Individual, "", "");

}

if(JobProd != null)
  {
  
  JobOper = (from JobOper_Row in Db.JobOper
               where string.Compare(JobProd.Company, JobOper_Row.Company, true) == 0
               && string.Compare(JobProd.JobNum, JobOper_Row.JobNum, true) == 0
               select JobOper_Row).FirstOrDefault();

I’m stepping out of my comfort zone and trying to learn, any help is appreciated. TIA!

Well this turned out to be the classical “too many hands in the pot” scenario. Found a BPM written by a former consultant that was clearing the temporary tables, which so happened to be firing before my BPM. Ugh… lovely.