1

I have a SharePoint 2013 designer workflow. it has an action "Wait for Item Update". Workflow does not resumes when i update the item through Code(C#) but when item is updated from out of the box edit form it resumes.

SPList listUpdate = web.Lists["Registration"]; SPListItemCollection items = listUpdate.GetItems(new SPQuery() { Query = @"" + Convert.ToString(newItemid) + "" }); web.AllowUnsafeUpdates = true; items[0]["Title"] = "1"; items[0].Update(); web.AllowUnsafeUpdates = false;

1 Answer 1

0

Without seeing your code, one wonders if you executed the query?

class UpdateListItem
{
    static void Main()
    {   
        string siteUrl = "http://MyServer/sites/MySiteCollection";

        ClientContext clientContext = new ClientContext(siteUrl);
        SP.List oList = clientContext.Web.Lists.GetByTitle("Announcements");
        ListItem oListItem = oList.Items.GetById(3);

        oListItem["Title"] = "My Updated Title.";

        oListItem.Update();

        clientContext.ExecuteQuery(); 
    }
}
4
  • sorry my bad i didn't give you full info i am currently using Server side object model SPList listUpdate = web.Lists["Registration"]; SPListItemCollection items = listUpdate.GetItems(new SPQuery() { Query = @"<Where><Eq><FieldRef Name='ID' /><Value Type='Text'>" + Convert.ToString(newItemid) + "</Value></Eq></Where>" }); web.AllowUnsafeUpdates = true; items[0]["Title"] = "1"; items[0].Update(); web.AllowUnsafeUpdates = false; Nov 6, 2018 at 13:47
  • @MohammadMavia I don't see that you fire the query. You leave it at update() and no clientContext.ExecuteQuery();
    – Benny Skogberg
    Nov 6, 2018 at 13:59
  • And if you try the pasted code in the answer? Does that work?
    – Benny Skogberg
    Nov 6, 2018 at 14:00
  • 1
    see i am not using Client Side Object Model (CSOM) i am using server side object model it doesn't nee clientContext.ExecuteQuery() Nov 6, 2018 at 14:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.