Workflow ExecutionTimeSpan

Last week I had a problem as part of a service request at Microsoft. I should test how long it takes to create a record for a particular entity by a workflow. The whole thing had to be very precise, because the request has been caused by an excessive execution time of a plug-in chain when such a record has been created.

Experimental Setup

The workflow should create a new contact, based on the data of an existing contact record. Let’s name it a Light-copy without relations. It is so configured that an entry in the systemjobs will be created.

Workflow-Log

Unfortunately, the workflow log is not as meaningful as intended. It contains the only times to the minute.

Workflow ExecutionTimeSpan

But that brings me at least an idea. Dynamics CRM stores the data internally with a higher accuracy than it displays it on the surface. Now I just have to get that data, mind you in a CRM Online system.

Workflow ExecutionTimeSpan

Since it is well known fact that you can not access the database in CRM Online directly, I planned to create a query that returns “Created On” and “Modified on” of my workflow. I used the OData Query Designer from the Dynamics XRM Tools to create that query.
When selecting the fields for my query I found a field named “Zeitspanne für Ausführung” field, or in English “ExecutionTimeSpan”. BINGO! That sounds good!

The Query

YOURSERVERURL/xrmservices/2011/OrganizationData.svc/AsyncOperationSet?$select=Name,StartedOn,CreatedOn,CompletedOn,ModifiedOn,ExecutionTimeSpan&$filter=OperationType/Value eq 10&$orderby=CreatedOn desc

To make the URL more understandable for you:

  • The Organization Data Service (OData) URL of your CRM.
    YOURSERVERURL/xrmservices/2011/OrganizationData.svc
     
  • The table from which I need the data.
    AsyncOperationSet?
     
  • The columns from the table that I would like to see as result.
    $select=Name,CreatedOn,StartedOn,CompletedOn,ModifiedOn,ExecutionTimeSpan
     
  • There should be only system jobs of type “Workflow” being returned.
    $filter=OperationType/Value eq 10
     
  • Finally, I would like to have the results sorted by creation date, so that the most recent are on top.
    Who wants to look for a long time.
    $orderby=CreatedOn desc

The Result

In the marked area you can see the columns that we have retrieved and in line 23 the value of workflow ExecutionTimeSpan.
Thus, so the workflow had an execution time of 1.7 seconds.

With Power Query for Excel you can you view the data a little more beautiful, or a whole series of workflows to evaluate and calculate averages with Excel or be generated diagrams. Simply Excel.

Hope it helps!

 

3 thoughts on “Workflow ExecutionTimeSpan

LEAVE A COMMENT