Workflows running twice

I’ve found that in some cases during a migration, workflows may have the ability to run twice. You can even start a brand new workflow for a list, and even that will run twice. I looked more into it, and it appears that upon migration, both the 14 and 15 version event receivers were present. I did some powershell to find and remove the 14 (I’m on SP2013) event receivers.

$spWeb = Get-SPWeb -Identity http://sitewebappURL

$spList = $spWeb.Lists[“List Name Here”]

$spList.EventReceivers | Format-List Id, Assembly, Type, Class

#Find the event receivers of ItemAdded and ItemUpdated for the old version (14 if you are on sp2013, 12 if you are on sp2010, so on). Make sure this output spits out the correct receiver you are trying to delete!

$spList.EventReceivers[#]

#Use the following command to delete the old version of the event receiver. Be careful not to delete the wrong one!

$spList.EventReceivers[#].Delete()

$spList.Update()

Then, try the workflow out again, and it should only run once.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s