This is another one of those posts that I just have to blog about because I feel like I will run into this same issue again sometime. I created a workflow using Nintex Workflow Enterprise. There’s an option in the workflow settings to “Enable workflow to start from the item menu” This is very useful because users can manually run this workflow from the item menu when they want to accomplish something. Examples that I have used this for are:
- End all workflows and delete current item from the list
- Archive a document
In the case of the Archive Document workflow that I created, which just moves a document to a separate doc library and deletes the original.When I enabled the option to have the custom workflow action in the menu, it somehow created a duplicate… so I now had two options called “Archive Document” when I only needed one.
How could this happen to me!? Of course it happened to me… Okay, so why did this happen?
Nintex listed two potential possibilities:
- Duplicate item: The workflow was imported from another environment/site/list multiple times with the menu item enabled.
- Orphaned item: The workflow was deleted without first disabling the menu item in Workflow Settings.
The weird part is that neither one of these actually applied to me. The duplication occurred as soon as I published the workflow for the first time. This was an original workflow on it’s own list with no other workflows present.
Let’s fix this thing!
From the research I’ve gathered over at Nintex it seems that there are two main ways to resolve this.
- PowerShell (of course!)
- SharePoint Designer (of course!)
I actually had a lot of trouble finding this option in SPD.. mainly because my SPD was opening this list in 2010 as opposed to 2013? Uhhhh… This is a new one (will have to figure this one out later) So let’s use the method our best friend would use.. PowerShell
Here is the code from Nintex
[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")
$($($(New-Object -TypeName Microsoft.SharePoint.SPSite('http://WebURL')).OpenWeb()).lists['ListTitle'].UserCustomActions)
Once you have run the above script, you can target the menu item by its index and delete it by running the below snippet:
$($($(New-Object -TypeName Microsoft.SharePoint.SPSite('http://WebURL')).OpenWeb()).lists['ListTitle'].UserCustomActions[0]).Delete()
I ran into a weird issue with this code. Pulling the custom action wasn’t a problem, it shows the one custom action that I had on this list with a sequence of [0] (and I say one, because I removed one entry from the duplicates by disabling the workflow settings option)

The problem came when I tried to the delete it…

Null? It’s right there! So since it was the only custom action item showing… I removed the [0] and told it to delete them all (just the one)

I then reran the original code to see if the custom action would show… nothing showed up! So I checked my list and sure enough it was gone. AHHHHHHHHHHHH Yeah!
I hope this helps someone else! Happy Nintexing