locked
How to write info to workflow details at custom workflow activity RRS feed

  • Question

  • Hi all,

    I want to write some log to the workflow details at the custom workflow activity code.

    How can I implement it?

    Regards,

    Cheney

    Monday, January 28, 2013 2:37 AM

Answers

  • Oh so you want general logging of you workflow code. I doubt that is possible using the Details section which you have highlighted. I would suggest you to take a look at the Log4Net appender for CRM 2011

    https://crm2011appender.codeplex.com/

    I think this should solve your problem. Let me know if this helps.


    Please don't forget to mark the answer, if it helps. Piyush

    • Marked as answer by CheneyGu Thursday, February 7, 2013 12:54 AM
    Monday, January 28, 2013 6:39 AM

All replies

  • A reference to a tracing service implementation can be obtained from the service provider passed to plug-in’s Execute method.

    The ITracingService interface provides a way to log plug-in run-time information. This method of logging information is especially useful for sandboxed plug-ins registered with Microsoft Dynamics CRM Online that cannot otherwise be debugged using a debugger.

    The tracing information is displayed in a dialog of the Microsoft Dynamics CRM Web application only if an exception is passed from a plug-in back to the platform.

    ITracingService Interface

    Example here:

    Sample: Create a Custom Workflow Activity


    Jason Lattimer
    My Blog -  Follow me on Twitter -  LinkedIn

    Monday, January 28, 2013 3:18 AM
    Moderator
  • Hi ,

    Thanks for your reply !

    I want to show the information at the details textbox of the workflow.

    Is there a message field of executing workflow details that I can update to display at the details area.

    Regards,

    Cheney


    • Edited by CheneyGu Monday, January 28, 2013 6:10 AM
    Monday, January 28, 2013 6:09 AM
  • Hi Cheney,
    As JLattimer suggested, the only option to trace something in the details section is using the ITracingService Interface. See below a small implementation of the interface

    ITracingService tracingService = (ITracingService)serviceProvider.GetService(typeof(ITracingService));
    tracingService.Trace("You will see this messsage in the details section");

    The way it works is, if your custom code encounters an error and stops executing then all the details which you have tried to log using the tracing service will be displayed in the details section.

    You don't have to update any field in order to get your workflow details into this box, just using tracing service will help.


    Please don't forget to mark the answer, if it helps. Piyush

    Monday, January 28, 2013 6:21 AM
  • Hi Piyush,

    Thanks for your kind reply!

    There must be exception threw,the trace log be displayed.

    I just want to write some information to the details textbox.And the workflow can be run normally.

    Regards,

    Cheney


    • Edited by CheneyGu Monday, January 28, 2013 6:36 AM
    Monday, January 28, 2013 6:33 AM
  • Oh so you want general logging of you workflow code. I doubt that is possible using the Details section which you have highlighted. I would suggest you to take a look at the Log4Net appender for CRM 2011

    https://crm2011appender.codeplex.com/

    I think this should solve your problem. Let me know if this helps.


    Please don't forget to mark the answer, if it helps. Piyush

    • Marked as answer by CheneyGu Thursday, February 7, 2013 12:54 AM
    Monday, January 28, 2013 6:39 AM
  • Hi Cheney,

    I hope this question of your's is answered. Can you take some time out and mark the answer that helped you resolve it.

    It would be highly appreciated.


    Please don't forget to mark the answer, if it helps. Piyush

    Wednesday, February 6, 2013 11:23 AM