4312 Views // 0 Comments // Not Rated

SharePoint 2007 Workflow - Issue With Content Type For Custom Edit Forms

I just ran into a little gotcha with SharePoint workflows. If you are using custom edit forms, you're going to have to create a new content type for them. This requires only adding a new XML file to your WF project that has a no more than a dozen lines, and adding it to your feature.

The only annoying thing here is the cryptic ID you need to generate for your content type. This ID is build from welding a hex number signifying the parent content type you are inheriting from to a new GUID with the dashes removed. To inherit from the WorkFlow type, generate a new GUID, remove the dashes, and add this before it: "0x01080100"

Don't ask me why we couldn't just create a new GUID for the ID and select an item from an enumeration as a separate "parent type" property. It's like any new feature in SharePoint has to start out really complicated, then become easier in v. Next. But I digress...

So I had a workflow in development, and as I'm getting it ready for beta testing, decided to rename it to something more intuitive than "TestWorkflow.GodIHopeThisWorks" So first, I generated a new GUID to make sure that this was a unique new instance of both my feature and my content type; SharePoint seems to have trouble letting go of old versions of content types, regardless of how many times you blast it with an iisreset.

So I reinstalled my feature, created a new list with an instance of my workflow, and everything seemed okay. I kicked off a new item, but the workflow did not start. No errors, no nothing. I refreshed my page several times, but nothing happened; My new list item just sat there, not working, not flowing. WF in SharePoint seems to always indicate (although poorly) when something's wrong. So it was once of those situations when no error is worse than an "unexpected" error.

Peeking in the logs, I finally found an exception that made some sense:

AutoStart Workflow: Microsoft.SharePoint.SPException: A duplicate name "Test Content Type" was found.

So after digging around for a while, I remembered (that I forgot) to change the name of my content type. And that was it! It looks like even though I gave my content type a new GUID, the combination of a GUID and a name have to be unique! Gotcha!

No Tags

No Files

No Thoughts

Your Thoughts?

You need to login with Twitter to share a Thought on this post.