Increase IExecutionContext.Depth

Navržená odpověď Increase IExecutionContext.Depth

  • 16. května 2012 10:31
     
     
    hey any one know how to increase  IExecutionContext.Depth property?

    sumit kumar

Všechny reakce

  • 16. května 2012 12:36
     
     Navržená odpověď

    This field is automatically managed by CRM if you have a plugin that triggers another plugin within the same transaction. Therefore, you cannot manually 'increase' it.

    Out of curiosity, why do you need to increase it?


    Dimaz Pramudya - CRM Developer - CSG (Melbourne) www.xrmbits.com http://twitter.com/xrmbits

  • 16. května 2012 12:47
     
     

    Thanks for you reply Mr. Dimaz Pramudya. 

    I need to perform a common task on multiple(more than 1000 at a time) records by on demand workflow.


    sumit kumar

  • 16. května 2012 12:51
     
     Navržená odpověď

    Hi Sumit,

    In that case, you wouldn't need to worry about the IExecutionContext.Depth at all.

    To solve your issue, you can create the parent on-demand workflow that will kick start the child workflow for each of the 1000 records.

    Depending on how often you are running this, there could be some performance impact. Please tell us more about your requirements so that we can help you with the correct solution.

    I hope this helps. If my response answered your question, please mark the response as an answer and also vote as helpful.


    Dimaz Pramudya - CRM Developer - CSG (Melbourne) www.xrmbits.com http://twitter.com/xrmbits

  • 16. května 2012 12:55
    Moderátor
     
     Navržená odpověď
    From workflow, if you force your workflow to wait for 1 hour then the depth will be reset to 0.

    Gonzalo | gonzaloruizcrm.blogspot.com

  • 16. května 2012 13:01
     
     

    let me describe you my whole scenario.

    I am developing a Payroll application.
    In my application a payroll manager will calculate salary of selected employees.

    For this I created a view for Employee Entity and created a customWorkFlow Activity which will execute on demand.

    Now Payroll manager will select Employees from the view and run the workflow.

    One payroll manager can have multiple Employees(more than 1000 or even more). 

    and for sure I will mark your comment as answer if they will help me.

    Thanks.


    sumit kumar

  • 16. května 2012 13:03
    Moderátor
     
     

    Hi Sumit,

    the number you see in context.Depth seems to be unrelated to your scenario. The context depth means that one operation triggers another which triggers another and so on (a chained trigger of events). But in your case, the depth should not go above 3 even if you execute the workflow on multiple records.

    Are you getting any failure about the depth? if so, can you describe how your custom workflow activity works?


    Gonzalo | gonzaloruizcrm.blogspot.com