Hi All,
I’m currently working on a data directive to stop users from changing due dates in Project Tasks if the current time is within 30 days of the due date already in the system. I wrote an ‘In-Transaction’ data directive in which I try to check the date stored in the database, not the ttDueDate, as this would be the original due date before the change was made. The issue I’m having is that the Db.ProjectTask is returning the same date as ttProjectTask.
Within30 = false;
TEST = "";
foreach(var ttProjectT_iterator in (from ttProjectT_Row in ttProjectTask
where ttProjectT_Row.Updated()
select ttProjectT_Row) )
{
var ttProjectTRow = ttProjectT_iterator;
var ProjT = (from ttProjectT_Row in Db.ProjectTask
where ttProjectT_Row.ProjectID == ttProjectTRow.ProjectID && ttProjectT_Row.TaskID == "010-INFD"
select ttProjectT_Row).FirstOrDefault();
TEST += "DB: " + ProjT.DueDate.ToString();
TEST += "TT: " + ttProjectTRow.DueDate.ToString();
DateTime origDue = (DateTime)ProjT.DueDate;
if((origDue - DateTime.Now).TotalDays <= 30)
Within30 = true;
}
I thought that in-transaction data directives ran before the database was updated? At least it looks this way in all the Epicor documentation on BPMs. If not, is there a better way to accomplish my goal?
Thanks in advance for your help.