Update in BAQ Export Process not working

I have created an updatable BAQ using the Advanced BPM update option and configuration. I have some code in the post-processing GetList directive that sets the Earliest Apply Date to today. This works fine when I run it within the BAQ designer. If I try to run it in the BAQ Export Process nothing happens. It does not update the EAD. Here is the custom code from the directive:


using (var updater = this.getDataUpdater("Erp", "EAD"))
{
            var EADType = Db.EADType.FirstOrDefault(
                tableRow => tableRow.EADType1 == "IP");
            if (EADType.EADType1 != null)
            {
                EADType.EarliestApplyDate = BpmFunc.Today();
            }

}


foreach (var ttResult in ttResults)
{
    ttResult.RowMod = "";
}

Why would this code not update the EAD in the Export? My goal is to have this run on a weekly schedule.

I did some research and found that the BPMs don’t update when you schedule it to run. I did more digging and found that you can schedule an Epicor function where you can put custom code in. I created a library, added the desired table as a reference, created a custom code function with the following code and ran it via Schedule Epicor Function and ran it Now. Low and behold this worked!

var EAD = Db.EADType.Where(e => e.EADType1 == "IP");
  foreach (var EA in EAD)
  {
      EA.EarliestApplyDate =  BpmFunc.Today();
   }
  Db.SaveChanges();

I have a solution currently running off of a BAQ GetList method that is scheduled as an export. Not sure why yours isn’t working?

Is yours doing an update to data? I found that while it does trigger the GetList, the update part does not work. I may not have phrased my previous post correctly.

I have a custom quote expiration process.

Summary
Erp.Tables.QuoteHed QuoteHed;

foreach (var x in ttResults)
{
  //Double check
  if(x.QuoteHed_ExpirationDate < Constants.Today)
  {
    try
    {
      //Grab the actual quote record to check the expired box
      var quoteExpir = (from qrow in Db.QuoteHed
            where qrow.SysRowID == x.QuoteHed_SysRowID
            select qrow).FirstOrDefault();
      
      //Expire the quote
      using(var txScope = IceDataContext.CreateDefaultTransactionScope())
      {
        //this.PublishInfoMessage(x.QuoteHed_QuoteNum.ToString(), Ice.Common.BusinessObjectMessageType.Information, Ice.Bpm.InfoMessageDisplayMode.Individual, "", "");
        quoteExpir.Expired = true;
        
        Db.Validate();
        txScope.Complete();
      }
      
      if(x.QuoteHed_ReasonType == "")
      {
        //this.PublishInfoMessage("made it here", Ice.Common.BusinessObjectMessageType.Information, Ice.Bpm.InfoMessageDisplayMode.Individual, "", "");
        //Mark the current task complete and LOSE the expired quote
        using(Erp.Contracts.TaskSvcContract t = Ice.Assemblies.ServiceRenderer.GetService<Erp.Contracts.TaskSvcContract>(Db))
        {
          string wClause = "Key1 = '" + x.QuoteHed_QuoteNum + "' AND RelatedToFile = 'QuoteHed'"; 
          string wClauseCnt = "";
          int pageSize = 0;
          int absolutePage = 0;
          bool mPages = false;
          
          //Get All Tasks for Quote
          Erp.Tablesets.TaskTableset tts = t.GetRows(wClause, wClauseCnt, pageSize, absolutePage, out mPages);
    
          string relatedToFile = "QuoteHed";
          string key1 = x.QuoteHed_QuoteNum.ToString();
          string key2 = "";
          string key3 = "";
          //Grab the last task in the taskset for the quote
          if(tts.Task.Count != 0)
          {
            int taskSeqNum = tts.Task[tts.Task.Count-1].TaskSeqNum;
            tts = t.GetByID(relatedToFile, key1, key2, key3, taskSeqNum);
            
            //Make sure you don't lose a quote that is waiting to become an order
            if(tts.Task[0].IsLoseable)
            {
              tts.Task[0].Complete = true;
              tts.Task[0].Conclusion = "LOSE";
              //Expired ReasonCode
              tts.Task[0].ReasonCode = "RC000112";
              tts.Task[0].TaskCompletePasswordIsValid = true;
              tts.Task[0].RowMod = "U";
              
              t.Update(ref tts);
            }
          }
        }
      }
    }
    catch(Exception e)
    {
      x.Calculated_ErrorLog = e.Message.ToString();
    }
  }
}

Did you test and confirm that the process was updating when clicking the GetList button inside the designer?

I have my code inside of the Base Directive. But that shouldn’t make a difference.