Pulling data from other table that are not available in current BO

Hi Everyone,

I have a simple question over here hoping for someone to shed some light on it.

I’m trying to create a method directive on BO.PaymentEntry but I wanted the condition to reference a UD field which I placed on APInvoiceHed.

Does anyone knows how to achieve this?

Thanks in advance!

What you can do is create a BAQ that retrieves the UDfield for the row you are working with and use the Dynamic query Business Object to call it. Here’s an example of one I’ve done using some code.

You’ll need to include the Ice.Contracts.BO.DynamicQuery Business object in references.

//Run BAQ from BPM

using (var dynQry = Ice.Assemblies.ServiceRenderer.GetService<DynamicQuerySvcContract>(Db))
  {
  /* First line gets the set of parameters for the given query and then the 
  subsequent lines set our temporary pjobNum and poprSeq to be a reference to those parameters*/
  var dynQryParam = dynQry.GetQueryExecutionParametersByID("GetEmployeeName");
  var pEmplNum = dynQryParam.ExecutionParameter.Where(r=>r.ParameterID== "inNum").FirstOrDefault();
  
  /* set the parameter value to the value retrieved from the temporary table. */
  pEmplNum.ParameterValue = emplNum;
  
  /* run query */
  var ds2 = dynQry.ExecuteByID("GetEmployeeName", dynQryParam);
  
  /*store values from query to use outside of the scope of this block of code*/
  emplName = Convert.ToString(ds2.Tables["Results"].Rows[0]["EmpBasic_Name"]);
  
  }

image

Alternatively you can use the Invoke BO method widget to call the GetQueryExecutionParametersByID and ExecuteByID methods to do the same thing as the above code snippet