Question Status

Suggested Answer
Eitan Mizrahi asked a question on 9 Feb 2015 3:17 AM

I need to run some code in before each method (when method starts - I need to run a specific code - That's is for QA manner, and is running when I need to), and at the end of each method.

How can I do that?

Is there any way or class which is common to all the classes and tables?

(Of course, I don't want that my method will also running in that class, or whatever is the solution, so there were not be an infinitive loop).

Handle of the class is also fine (so I can write in C#), but X++ is the preferred way.

Thanks :)

Reply
Suggested Answer
Baber Owais responded on 9 Feb 2015 6:07 AM

You need to write pre and post event handlers for a method if you want to run specific logic before and after a method. Check the following link for X++ event handling:

msdn.microsoft.com/.../gg839762.aspx

Thanks,

Baber.

Reply
Amir Nazim responded on 9 Feb 2015 6:39 AM

could you explain what would you like to achieve with this ? Baber solution will works for specific classes/ tables methods. You would like to achieve some security ?

Reply
Suggested Answer
DG responded on 9 Feb 2015 7:01 AM

Hi Eitan,

I am not aware of any such method. Alternatively, there is a utility called 'Trace parser' available which you can set to see all X++ calls. If only auditing is the purpose, it will serve it.

Regards,

Deepak

Reply
Eitan Mizrahi responded on 9 Feb 2015 7:22 AM

What I meant is not adding pre+post handler on a method.

Just handling pre+post (I know the method name).

That's for some QA purpose, or someone who doesn't need to deal with code for farther progress.

Thanks :)

Reply
Suggested Answer
Iulian Cordobin responded on 9 Feb 2015 1:41 PM

Basically if you are asking if there is an 'Object' class that is used to derive every class in AX that you can implement code into the answer is no.

Iulian Cordobin | http://axfaq.blogspot.com | New March'15 tool released: http://ieide.codeplex.com

Reply
Suggested Answer
Baber Owais responded on 9 Feb 2015 6:07 AM

You need to write pre and post event handlers for a method if you want to run specific logic before and after a method. Check the following link for X++ event handling:

msdn.microsoft.com/.../gg839762.aspx

Thanks,

Baber.

Reply
Suggested Answer
DG responded on 9 Feb 2015 7:01 AM

Hi Eitan,

I am not aware of any such method. Alternatively, there is a utility called 'Trace parser' available which you can set to see all X++ calls. If only auditing is the purpose, it will serve it.

Regards,

Deepak

Reply
Suggested Answer
Iulian Cordobin responded on 9 Feb 2015 1:41 PM

Basically if you are asking if there is an 'Object' class that is used to derive every class in AX that you can implement code into the answer is no.

Iulian Cordobin | http://axfaq.blogspot.com | New March'15 tool released: http://ieide.codeplex.com

Reply