Posts

Showing posts from July, 2019

Dynamics AX Transaction scope and UserConnection class

We have done some customization in AX which perform insertion and updating data on multiple tables. It oftens fails and we have no clue where it fails so we decided to implement logging just for knowing how much steps are performed up till and if it fails where did we fails. We decided we will create separate table for logging and records every step in table which is about to performed so in this way we detail about steps. Normally we perform all activity in one transaction so if something fail whole process should be reverted but we want that our log should persists in table. There is a class UserConnection which exactly do what we wanted it to do. You just have to create its instance and on table just mention that it AX should use this new connection for this particular table. I am giving you an example.   static void SampleUserConnection_Job(Args _args) { VendTable vendtable; MyLogTable myLogTable; UserConnection userConnection = new UserConn