Steps to enable Server Side Tracing
- Navigate to Settings > Administration > System Settings > Customization Tab
- Click on “All” in the Enable logging to plug-in \ custom workflow trace log dropdown to enable tracing service.
- The trace will be downloaded/located in Traces folder of Microsoft Dynamics installation folder. By default, the folder will be located in C:\Program Files\Microsoft Dynamics CRM\Trace. (On-Premise)
- The error log files will look as mentioned below.
For an Asynchronous registered custom workflow activity returning an exception, the tracing viewed will be as below.(Online)
Steps to Open Error log in custom workflow activity:
- Go to Advanced find and select System Jobs option in the ‘Look for’ Dropdown
- Click on results and select Workflow related logs in the system jobs name column displayed as shown below.
- Example of a Custom Workflow code which will throw exception while updating the service record as Invoice object is not initialized.
- Double click on the workflow which needs to be traced in the system jobs page, a pop-up window will open as shown below.
- The following exception will be thrown in the Error Stack trace when the above code is executed.
Entered InvoiceRemainder.Execute(), Activity Instance Id: 1, Workflow Instance Id: 456fc565-cadc-42fd-9242-7ddcf654ad0d
InvoiceRemainder.Execute(), Correlation Id: d6369603-801e-405e-b162-6a158fcb42b2, Initiating User: 8cf5c01e-42cc-e211-9081-00155d517828
Unhandled Exception: Microsoft.Crm.CrmException: Unexpected exception from plug-in (Execute): GS1.CRM.Workflows.InvoiceProcessing.InvoiceRemainder.InvoiceRemainder: System.ArgumentNullException: Value cannot be null.
Parameter name: value
at Microsoft.Crm.Sandbox.SandboxCodeUnit.Execute(IExecutionContext context)
at Microsoft.Crm.Workflow.Services.ProxyCustomActivity.Execute(CodeActivityContext executionContext)
For the most part, workflows are asynchronous. However, if you have synchronous workflow along with custom workflow activity, it can return an exception to the platform in an error dialog box in the web application as displayed below.
User may select Download Log File button in the dialog to view the log containing exception and trace the output.
Be sure to turn off tracing once you have collected the information!
If you would like to know more about our MS Dynamics CRM Services, then do leave an enquiry with us here.