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.
2. Visit Application explorer in visual studio and open the class you want to debug.
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]
ProTip: If you would like to see the workflow going into and out of the process que use the form Tutorial_WorkflowProcessor and run it before starting the workflow.