Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 25064

update item code does not trigger wait for field action in workflow created by sharepoint designer

$
0
0

Hello
I have a workflow created by SharePoint Designer which have a "wait for myField to not equals oldValue".
I also wrote a code shown as below to update myField of multiple items. after running code all certain items update to NewValue but workflows of the items stayed at wait.. action and do not trigger and do not continue next actions.
when I change myField in user edit the items manually it does trigger the workflow.
Q: what changes do I have to apply in my code to cause triggering workflows?

using (SPSite oSPsite = new SPSite(""))
{
           using (SPWeb oSPWeb = oSPsite.OpenWeb())
            {
                 oSPWeb.AllowUnsafeUpdates = true;
                 SPList list = oSPWeb.Lists["Mylist"];

                   foreach(SPListItem itemToUpdate in list.Items)
                          if (itemToUpdate["HREC_AirTicket_Status"].Equals("OldValue"))
                            {
                                          itemToUpdate["HREC_AirTicket_Status"] = "NewValue";  
                                            itemToUpdate.Update();
                            }   
                  oSPWeb.AllowUnsafeUpdates = false;
             }
}
   


Viewing all articles
Browse latest Browse all 25064

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>