To debug X++ code written in event handler classes of a workflow, you need to follow these steps:
1. Run an incremental IL if you have made any changes to the class.
3. In VS goto Debug option and click on Attach to Process and change code type to Manage v4.0
4. Select show all process in all sessions and select Ax32Serv.exe
(note: you might see more than one Server process, if you cant determine which one to select then select all Ax32Serv process) and attach.
5. Now place breakpoints on the code you want to debug and run the workflow, execution will stop in visual studio once the event is fired.
For more information visit : Msdn How to: Debug X++ Code in Workflow [AX 2012]