Today I ran into a 'feature' of MS Dynamics CRM 2011.
In a nutshell, I wanted to use a workflow to create a variable number of records at a certain point in the orders life-cycle.
My idea was to use a numeric field that was populated at the point of the trigger. Once this field was detected as 'changed' the workflow would fire, create the record, then decrement the same field, thereby triggering the workflow again - until the value was 0.
The problem is, that CRM 2011 has a built in feature called Execution Context Depth. This is designed to prevent the program from going into an infinite loop when running workflows, and crashing your CRM server.
By default, the limit for this 'depth' is set to 8 levels, with a timeout of 60 minutes.Which is why I was only getting 6 records created before the workflows would fail.
So you have a choice of either working with the 8 level limit or, as I found out from the Sliong Blog, you can change the defaults by editing the MSCRM_CONFIG db.
You can change the Depth of execution using this sql:
update DeploymentProperties set IntColumn = X where ColumnName = 'MessageProcessorMaximumDepth'
And 'MessageProcessorMinimumInactiveSeconds' for the time limit.