This is my first time coding so bare with me. Below is a part of the code that updates a field in the current Opportunity attached to an Account, I think this is where I need to make the changes to accomplish what I need.
Currently the field for all the opportunities attached to the account get updated but I need that only Opportunities with a status set to "In Progress" get updated.
I believe I need to add an if statement around "Service.Update(ChildToUpdate" but I cannot seem to find how to code: If Status == "In Progress" then do the update....
I would appreciate any feedback. Thank You.
List<Entity> children = (from child in serviceContext.CreateQuery(childEntity)
where ((((EntityReference)child[childParentField]) != null)
&& (((EntityReference)child[childParentField]).Id == triggerId))
select child).ToList();
foreach (Entity child in children)
{
Entity childToUpdate = service.Retrieve(childEntity, child.Id, new ColumnSet(new string[] { valueToUpdateChildDest }));
childToUpdate[valueToUpdateChildDest] = valueToUpdate;
service.Update(childToUpdate);