locked
Problem with invoking a workflow programatically RRS feed

  • Question

  • Hi All,

    I am adding an item to a list through code (from other aspx page in the same sharepoint server) using listitem.update() method. this was not initiating the workflow of the list automatically (when I add an item to the list using sharepoint itself, it was raising and running successfully). will the workflows don't raise when the items are added or updated programatically ?

    however, I tried to run the workflow programatically after the update() method using workflowmanager.startworkflow(). But for this we need to pass the association data. I'm getting the association for the list item but it doesnot contain the association data so it was giving null. I tried to put string.empty, '<root/>' values inplace of association data parameter and none of them worked.

    • Edited by Mike Walsh FIN Thursday, February 10, 2011 9:23 AM Desperately need is no better than your usual ASAP; Urgent etc. Stop doing this or your posts will be deleted.
    Thursday, February 10, 2011 4:55 AM

Answers

  • Is this a custom list or a document library?

    In either case, I've not had any problem with the workflow kicking off automatically, when programmatically posting.  If you're using a document library, I think you have to do an update of the file added, in addition to your list item update.

    If it's just a custom list, and you have required fields, maybe double check that you're populating those through code before you're calling Update()?

    • Marked as answer by Leoyi Sun Thursday, February 17, 2011 10:17 AM
    Monday, February 14, 2011 7:25 PM