SharePoint Designer Workflow, Event Receivers and “Update List Item” versus “Set Field in Current Item”

We have a set of SharePoint designer workflows that "communicate" with an event receiver on the list via changes to site column values.  For example, if a site column "SetDuedate" is set to true by the workflow, the event receiver detects that change, calculates a due date and assigns that date to another site column, "Due Date."  We split things up like this because the event receiver can calculate a due date using complex business rules (taking weekends and company holidays into account) while SPD really can not.

In one specific instance, we ran into a problem with this trick.  Debugging all this is pretty difficult, but we came to the definite conclusion that in one case (at least), the event receiver was not running all the time.  In one step of the workflow, we would change the value of a site column and the event receiver didn’t appear to run.  However, it was running consistently in a different step of the workflow.

After reviewing it, I noticed that the happy workflow step used the "Update List Item" while the other step used "Set Field in Current Item."  Update List Item was updating the "current item."  I’m not sure why we picked one over the other since they would seem to be doing the same thing.

So … the Update List Item action did cause the event to fire.  On the other hand, the Set Field in Current Item action did not.

I used Update List Item in both places and viola!  It worked.  [[ Total aside, I played the violin for on a daily basis for almost 15 years ]]

From this, I tentatively believe that the "Set Field" action does not cause event receivers to fire, at least some of the time. 

This issue bedeviled us for weeks. 

This is one of those "observed behavior" posts.  I observed this happen once in a specific environment and I’m making some guesses as to why things happened as they did.  If you have any insight into this one, please share in the comments.

</end>

Subscribe to my blog.

Technorati Tags:

3 thoughts on “SharePoint Designer Workflow, Event Receivers and “Update List Item” versus “Set Field in Current Item”

  1. No name
    Hi Paul,
    Nice blog you got there.. One quick question for you..
    Update List Item is supposed to be for updating any list item on the same sharepoint site..right?
    For me, it only works for the same list (just like Set Field in Current Item).. So what do I use for updating values from a different list?
    Thanks.
    Honeyhline~
    Reply

Leave a Reply to l Cancel reply

Your email address will not be published. Required fields are marked *