Run UBAQ via Function

,

I’m trying to run a UBAQ via an Epicor Function to update some fields in the BAQ.

I’ve ran a trace on the BAQ Designer screen to find the methods called, but when I built the Function following those methods, the fields don’t update, even though no error is thrown.

My Function contains:

  • DynamicQuery.GetByID - Retrieves the QueryTs.
  • DynamicQuery.GetExecutionParameters - Retrieves ExecutionTs.
  • Add the parameters via ‘Fill Table By Query’ node.
  • DynamicQuery.GetList - Used in the UBAQ trace.
  • Updating the fields in the DataRows via ‘Custom Code’ node + setting DataRow.RowMod = “U”.
  • DynamicQuery.Update - Updates the Results table.

Anyone have any knowledge on this?

Jordan, what method are you running this function from?

Is it tied to a BPM or data directive?

I am pretty sure you can call a uBAQ from code inside a BPM custom code widget as well so I am not sure if using a function is necessary.

Hi there,

I was placing this inside a Function mainly just for reusability. I will be using a lot of methods in an external web app as well.

I was running it from a Method Directive. I’ve it’s possible via custom code widget that will be easier than dragging and dropping multiple nodes.

Would you be able to provide the steps needed for this? Or should I just replicate what I have inside a custom code widget?

Jordan, I don’t know.

I know I have seen code on this forum calling a ubaq though. You might have luck searching for that.

@J_I Late to this post but I thought I would throw this out there. I’ve been using a scheduled function to run much of our integration UBAQs. The steps you tried can be simplified.

  • DynamicQuery.GetQueryExecutionParametersByID
  • DynamicQuery.ExecuteByID - Runs the GetList
  • Updating the fields in the DataRows via ‘Custom Code’ node + setting DataRow.RowMod = “U”.
  • DynamicQuery.UpdateByID - Updates the Results table.

If you don’t want to use custom code to set the RowMod, you can use an Update Table By Query widget in a Pre-Processing directive of the Update Method of the UBAQ.

Here is a basic version of the function.

UBAQRunner.efxb (26.4 KB)

9 Likes

@caleb.grundmeier Thanks mate! This has definitely given me ideas on some “Global” helper Functions!

Nice Caleb!