We faced the issue during import of solution to new organisation containing 100+ processes. Microsoft suggests to assign all workflows to the user who is going to import the solution. Refer: http://support.microsoft.com/kb/2626779/en-gb
We did not want to manually go and assign all this stuff to the new user. Hence, execute following server side code to achieve the same on target organisation:
WhoAmIRequest request = new WhoAmIRequest();
WhoAmIResponse response = (WhoAmIResponse)service.Execute(request);
QueryExpression query = new QueryExpression("workflow");
query.Criteria.Conditions.Add(new ConditionExpression("statecode",ConditionOperator.Equal,0));
EntityCollection processCollection = service.RetrieveMultiple(query);
foreach(Entity process in processCollection.Entities)
{
AssignRequest assign = new AssignRequest
{
//systemuser; i.e., User to whome you are assigning the entity to
Assignee = new EntityReference("systemuser", response.UserId),
//Current record which you are assigning to the user
Target = new EntityReference("workflow", process.Id)
};
// Execute the Request
service.Execute(assign);
}
The solution will start exporting after this without an error. Hope it helps!
Note:- You need to be System Administrator to be running this code.