Orphaned Workflow Menu Items

  • 16 August 2017
  • 0 replies
  • 43 views

Userlevel 3
Badge +8

I'm posting this as an alternative to another article posted here on removing orphaned and duplicate ECB menu Items. That one doesn't work for me since I have around 160 sites to manage with more on the way. We have a real problem with these buggers since we have to update our workflows more frequently than perhaps the normal workflow and we end up with alot of orphans in our menus. It's important to know at the start that we do not change the names of our workflows each time we publish a new version of the workflow. I doubt many places do but thought I'd mention that. If you are doing that this script won't work for you as written.

 

The script can be modified to run against every site in a farm or on a single list which is what I was after and explains why I'm not using LINQ or something more efficient. In this case ease of maintenance trumps efficiency and though it's loopy the script runs very quickly. While running this kind of thing for every site in the farm in one call is tempting due to the time it saves, I'm hesitant to call a delete method on anything at that scope.

 

The script takes the FQDN of a SharePoint site,  an array of Lists (what shows up as the Name in your list Settings page) and an array of workflow titles (find these on your workflow settings page for your list.)

 

The script gets the active workflow association for each workflow in the list and compares that id with the TemplateID on the workflow associations url property. Remember the url property of the workflow action looks like this:

 

~site/_layouts/15/NintexWorkflow/StartWorkflow.aspx?List={ListId}&ID={ItemId}&TemplateID=6d8fb31c-320d-4ff0-83d2-d4305976d9bf&Source={Source}

 

I have commented out the delete method in the attached script so be sure to uncomment that once you're sure you want to run it. I've left the write-hosts in place so you can see what all is on the lists before doing anything.

 

If you have any questions or comments leave them in the comments and I'll do my best to respond.


0 replies

Be the first to reply!

Reply