public static bool HasOpenSystemJobs(Guid regardingId, CrmService service) { QueryExpression qe = new QueryExpression("asyncoperation") { ColumnSet = new ColumnSet(false), TopCount = 1 }; qe.Criteria.AddCondition("regardingobjectid", ConditionOperator.Equal, regardingId); qe.Criteria.AddCondition("statuscode", ConditionOperator.NotIn, new object[] { 10, 30, 31, 32 }); return(service.RetrieveMultiple(qe).Entities.Count > 0); }