When to trigger a function in app studio layer

Here I am again with more than likely a simple question,

Every function I have created up to this point, has relied on an object like a button to trigger it. In my current case, I want my code to run after an AP Invoice line has been created. The function determines which site div to use.

The function works properly while using postman & creating new miscellaneous invoices, but I can’t seem to figure out the right event for the function to run before/after. I haven’t been able to find an event specific to the invoice line being saved. It seems like the function may be running, then being overwritten by Epicor’s event.

I’ve used the F12 debug console a bit, but is there a better way to figure out where the function should happen in the chain of events?

Thanks as always.

I assume you did CTRL ALT 8 so you could see the events fire. :popcorn:

What does your function do?

Could you trigger off these events?

After →

I tried firing after a couple events I saw in the CTRL ALT 8 menu, unfortunately no success on what I found.

The function changes the GL account div to match the user’s site, by default the posting engine always assigns “01” as the div, which is only correct for user’s in a certain site.

With that, the function should only run after the GL account info has been initially assigned. Otherwise the function would just get overwritten I believe.

I’ll see if any of the events you suggested get the job done.

Might want to consider a bpm.