In this post here (“Getting Answers Back from the Start Approval Process Activity”), I mentioned that you can accidentally add a whole slew of workflow variables to your SharePoint Designer workflow. Things can quickly become cluttered and hard to read. Specifically, if you add the “Start Approval Process Activity” action to your workflow, delete it and add it again, you end up with all of that activity’s workflow variables twice.
It’s a real pain to go through and delete all of those manually, so I though I would try to remove them directly from the XOML file. This proved to be easy enough to do.
First, you need to locate the actual XOML file. I wrote about that topic here: http://www.mstechblogs.com/paul/how-to-find-and-edit-spd-2010-workflow-xoml-files. Once found, open up the XOML file and locate a variable you want to remove. In this case, I added the "Start Approval Process” activity to my workflow twice. I want to remove a workflow variable named “isItemApproved” since it’s no longer used and there is a duplicate variable named “isItemApproved1”.
Simply do a text search for the variable. My screen looks like this:
If you search around in the XOML file, you’ll see that “IsItemApproved1” is used in many different places while the original "IsItemApproved” is simply defined once and never used.
Delete it and then save the file.
The only tricky part is that I had to actually close out SPD altogether and re-open it before SPD acknowledged that the field deleted.
Of course, deleting fields isn’t the only thing you can do with the XOML and I may blog about other topics like this in future.
You want to be very careful about what you do here and take backups of your work. You can make a seemingly minor / subtle change here that trashes the workflow as far as SPD is concerned and you could lose hours of effort while you rebuild it.
</end>
Follow me on Twitter at http://www.twitter.com/pagalvin
In many cases SharePoint is setup the way that developer desn’t have permission to see the underlying URL structure and files. This way you can’t see “All Files” item menu in SPD.
I found the work around using Export/Import to Viso 2010 menu itms. You don’t have to have Visio 2010 installed. When you export workflow SPD creates “wmi” file which is actually zip file. You can extract the XOML file edit it, package it back to the WMI file and import it back to the SPD.
Enjoy.