I’ve found recently that I’m needing to reuse the same BO calls, i.e for order creation/order detail changes. As such, I’ve created functions that I can invoke whenever I need to update the order. Since I can’t use member declarations in BPM code, I figured this was the best approach.
Essentially my BPM becomes a condition checker and the functions do most of the BO logic for updating. For example:
// BPM code
foreach (var dtlRow in ds.OrderDtl)
{
// Condition checking
// ...
this.InvokeFunction(...);
}
// Function code
ErpContext context = Ice.Services.ContextFactory.CreateContext<ErpContext>();
var bo = Ice.AssembliesServiceRenderer.GetService<...>(context);
// Match order lines and call BO methods
// ...
context.Dispose();
Questions: am I creating unnecessary overhead with the repeated function calls, since some orders can have many lines and I iterate through each? Should I just have everything in the BPM? Am I overthinking? Should I tell Claude to fix everything for me? 2 years of Epicor but I still feel like a noob.
guess it depends on how complex the function is. but i would also question if it would be possible to use a method call to the UpdateEXT method which allows you to update many lines/releases at once with one method call.
Right now they only execute the methods necessary as seen in a trace log. There’s also some debugging that appends lines to an email body but it’s pretty light work.
So for sales orders, GetNewOrderHed → ChangeSoldToID → Customer.GetRows → ChangeCustomer → MasterUpdate (credit checks excluded for brevity)
How much overhead are the EU getting? For example, we have queries that take multiple minutes, but when we converted them to LINQ their runtime was reduced dramatically. Most logic we want to recreate on a kinetic screen (for example, returning inventory) we transformed into functions because it was much quicker than doing it the app studio or standard way.