Custom Code Errors calling BO from uBAQ

,

I am trying to create check headers for AP payments inside a UBAQ using a custom code BPM. It’s not attached to a table, I just have calculated fields for the user to dump data into and then have the checks created. I have read all the posts and watched a very helpful video and have gotten rid of most errors. I have 2 I can’t figure out.

var newCheck = ttResults;

foreach(var check in newCheck)
 {
  string myCompany = check.Calculated_Company;
  int myCheckNum = check.Calculated_Check;
   
  var existingCheck = (from ch in Db.CheckHed where ch.Company == myCompany && ch.CheckNum == myCheckNum select ch).FirstorDefault();
  if (existingCheck == null)
     {
      using(var checkSvc = Ice.Assemblies.ServiceRenderer.GetService<Erp.Contracts.PaymentEntrySvcContract>(this.Db))
        //Trace: <businessObject>Erp.Proxy.BO.PaymentEntryImpl</businessObject>
        
      {
        Erp.Tablesets.PaymentEntryTableset checkData = new Erp.Tableset.PaymentEntryTableset();
              
        checkSvc.CreateNewCheckHed(check.Calculated_Group, ref checkData);
             
        bool requiredBoolParam = false;
        checkSvc.PostAllowed(check.Calculated_Group, out requiredBoolParam);
        // from Data Trace- not sure where it's pulling False from 
        //<parameter name="allowed" type="System.Boolean"><![CDATA[False]]></parameter>
        
        checkSvc.GetElecInterface(check.Calculated_Group, out requiredBoolParam);
        
        checkData.CheckHed[0].VendorID = check.Calculated_VendorID;
        checkSvc.OnChangeVendor(check.Calculated_Group, ref checkData);
        
        checkSvc.PostAllowed(check.Calculated_Group, out requiredBoolParam);
        // from Data Trace- not sure where it's pulling False from 
        //<parameter name="allowed" type="System.Boolean"><![CDATA[False]]></parameter>
        
        checkSvc.OnChangeCheckNum(check.Calculated_Check, ref checkData);
        
        checkSvc.OnChangeCheckDate(check.Calculated_Date, ref checkData);
        
        checkSvc.PreUpdate(ref checkData, out requiredBoolParam);
        // from Data Trace- not sure where it's pulling False from 
        //<parameter name="requiresUserInput" type="System.Boolean"><![CDATA[False]]></parameter>
        
        checkSvc.Update(ref checkData);
        }
            }
              }

#1: ‘IQueryable’ does not contain a definition for ‘FirstorDefault’ and no extension method ‘FirstorDefault’ accepting a first argument of type ‘IQueryable’ could be found (are you missing a using directive or an assembly reference?)

#2: The type or namespace name ‘Tableset’ does not exist in the namespace ‘Erp’ (are you missing an assembly reference?)

You should be able to use Ctrl-Spacebar to get hints on these issues, so with the cursor at the t in default hit Ctrl-Space and assuming you don’t have other syntax issues you will get a hints.

Case is specific in C#. FirstOrDefault and tablesets is plural.

I can’t believe it was that simple :melting_face: I only spent 2 hours trying to figure it out…

I’ve spent 3 days looking for a missing semicolon.

Soo true, but the grinding it out is what makes us what we are.

1 Like