I have been tasked with creating a stop in Epicor when receipting a PO. If a PO is over a certain value and is over 14 days early. when this stop happens I want to ping an email directly to the purchaser who created the PO.
So I write the BPM and put in a bit of custom code where I call upon the ttrcvdtl table. From there I can pull the required by date. i then add a comparison widget so as to check whether or not we are 2 weeks early. every thing works great so far.
I then look to use the ttrcvdtl table to link over to POHead.Db on the Po number so that I can pull the Entry person field so that I can start making my way over to the UserFile.Db. But for some reason, it doesnt fire. There is no Po Number coming from the ttRcvDetail.ds…and yet it was still able to pull the PODelivery date?? What on Earth am I missing here?
Anyone have any idea?? Many thanks in Advance
foreach (var ttRcvDtl_iterator in (from ttRcvDtl_Row in ds.RcvDtl where ttRcvDtl_Row.RowMod == "U" || ttRcvDtl_Row.RowMod == "A"
select ttRcvDtl_Row))
{
var ttRcvDtlRow = ttRcvDtl_iterator;
var PORelRow = (from PORel_Row in Db.PORel
where PORel_Row.PONum == ttRcvDtlRow.PONum && PORel_Row.POLine == ttRcvDtlRow.POLine && PORel_Row.PORelNum == ttRcvDtlRow.PORelNum
select PORel_Row).FirstOrDefault();
if (PORelRow != null)
{
//Get the dates
var DeliveryDate = PORelRow.NeedByDate;
var Today = DateTime.Today;
var interval = Today - DeliveryDate;
//Convert the dates from TimeSpan so that we have the number of days to compare
FirstDot = interval.ToString().LastIndexOf('.');
TheDays = interval.ToString().SubString(0,FirstDot);
Days = Convert.ToInt32(TheDays);
var POHeadRow = (from POHead_Row in Db.POHeader
where POHead_Row.PONum == ttRcvDtlRow.PONum
select POHead_Row).FirstOrDefault();
if (POHeadRow != null)
{
var UserFileRow = (from UserFile_Row in Db.UserFile
where UserFile_Row.DcdUserID == POHeadRow.EntryPerson
select UserFile_Row).FirstOrDefault();
if (UserFileRow != null)
{
string Email = UserFileRow.EMailAddress;
}
}
}
else
{
/*writer.WriteLine(System.DateTime.Now.ToString() + " JobHeadRow is null " );;*/
}
/*writer.WriteLine(System.DateTime.Now.ToString() + "JObHeadRow is not null " + callContextBpmData.Character04.ToString());
writer.Close();*/
}