Tuesday, February 13, 2007

Replace MOSS 2007 built-in Approval Workflow

Using the SharePoint ECM SDK I have managed to setup the Custom Approval Workflow sample - it works as expected.

However, co-existing with SharePoint default content approval seems to be quite confusing - especially to end-users. Both approval workflows appears in the end-user interface as outlined below:



In the example above I have approved the content using the Sample Appoval Workflow from ECM. Notice that the status is Approved for Sample Approval Workflow - whereas it is still pending for the built-in approval workflow.

If approving using the built-in approval buttons the system will notify me during the approval with the following message:






resulting in the following screen:



Now my content has been approved by the built-in approval workflow - whereas it is cancelled in my custom workflow.

Ideas very much appreciated.

8 comments:

Anonymous said...

Hi Morten,
I am new to Sharepoint stuff.
I am trying to do something like what you did.
I want to modify the default Approval workflow (and add few fields to the section where we add attachments..)
How can this be done?

Any help is greatly appreciated.

Thanks,
Madhuri

Morten Marquard said...

Hi,
Extending the built-in SharePoint workflow is not the easiest thing in the world.
First - look into InfoPath and modify/create a new form to catch the fields you wish to save with the workflow.
Not sure what you mean with "...where we add attachments".
It sounds to me that you need a whole new workflow.
Download the ECM kit and try using the examples as a start.
Good luck

Matthew Iverson said...

Were you ever able to figure this out? I am at a loss as to how to approach this problem.

Morten Marquard said...

My conclusion is that you cannot replace SharePoint's own approval workflow - but you can create your own. It's quite messy as you need to leverage SharePoint features for approval - which is un-documented and hard to figure out.

Anonymous said...

For some developers the following might be interesting.
When you associate your own approval workflow with a list, the default approval workflow will still remain - it was associated with the list content type when the list was created. To my knowledge it cannot be removed using the web interface (except by deactivating the routing workflows feature which you should not do). But writing a little piece of code, you can remove some of the default workflow associations for the list anyhow. E.g. enumerate the workflow associations to determine the GUID and subsequently remove the association:

SPList list = web.Lists["YOUR_LIST_NAME"];
SPContentType ct = list.ContentTypes["Document"];
SPWorkflowAssociation asso = ct.WorkflowAssociations[new Guid("THE_GUID_OF_WF_ASSO_TO_REMOVE")];
ct.RemoveWorkflowAssociation(asso);

Morten Marquard said...

Hi Dr.Jo
Interesting - I'll certainly try that out. Feedback provided at a later stage.
Morten

Sandesh S. Deshmukh said...

Hi Morten,
How would on implement the rule in the approval workflow such as when the document(word document) has been approved it will open only in read-only mode.

Thanks in advance!

Unknown said...

Hi Sandesh,
Did you find a solution to your question of making a document read-only after being approved?
Regards
Girish