Reputation: 2620
I created an event handler subscription on approveVariance
method in VendInvoiceInfoTable
.
Here is the code of the handler:
public static void postApprovingPendingInvoice(XppPrePostArgs _args)
{
VendInvoiceInfoTable vendInvoiceInfoTable;
vendInvoiceInfoTable = _args.getThis();
info(vendInvoiceInfoTable.PurchId + " from handler");
}
All god and fine if i check and uncheck the checkbox myself. I am talking about the checkbox found on VendInvoiceMatchingDetails form with label :
Approve posting with matching discrepancies.
The problem appears when that approveVariance
is called from a batch. The handler is not reached anymore.
Is this a correct behavior ? Is there any valid approach to this?
I think I can create a static method in a util class, and call it every time the approveVariance
is called and send a specific parmeter. I just tried to follow the best practices.
Upvotes: 0
Views: 160
Reputation: 11544
As Matej said, you need to build the CIL (incremental or full) as batch runs in the CIL (Common Intermediate Language).
When you write code, it initially compiles into P-Code, which is interpreted by the AX runtime environment. When you build the CIL, it interprets/compiles that p-code into the CIL.
When you say "older .dll", it's more like older *.xpp
files most likely located in c:\Program Files\Microsoft Dynamics AX\60\Server\[aos]\bin\XppIL\source
Here's a great article on the CIL
Upvotes: 1