how toloop thr all task (entitycollection.entities and check if any task that has CSU task status not equal to completed
Hi,
Please share your plugin code to help you on your query.
You can look at below article on how to loop through Entity collection.
Hi,
I am not sure about what "CSU" task means. But I think you can loop all task by LINQ.
As follow examples, I assumed the task status is an OptionsetValue and Completed status is 100000000 and the task status field name is taskstatus and your entitycollection variable is taskCollection.
// assumes int taskCompletedStatus = 100000000; string statusFieldName = "taskstatus"; EntityCollection taskCollection = new EntityCollection(); // replace this by your entitycollection // return true if there is any task status not equal completed bool isAnyUncompletedTask1 = taskCollection.Entities.Any(x => !x.Contains(statusFieldName) || x.GetAttributeValue(statusFieldName).Value != taskCompletedStatus); // return true if there is any task status not equal completed bool isAnyUncompletedTask2 = taskCollection.Entities.Any(x => x.GetAttributeValue(statusFieldName)?.Value != taskCompletedStatus); // also here is an example to filter task by your condition List taskList = taskCollection.Entities.Where(x => x.GetAttributeValue(statusFieldName)?.Value != taskCompletedStatus).ToList();
hi
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,240 Super User 2024 Season 2
Martin Dráb 230,149 Most Valuable Professional
nmaenpaa 101,156