Why "Start this workflow to approve publishing a major version of an item" option is disabled for my custom workflow in SharePoint?

by James 9/17/2008 2:39:00 AM

James Tsai .Net SharPoint Blog - Start Workflow To Approve Major Version Item

This is a common question from developer who is creating his/her first custom workflow for SharePoint.

Turn on "Create major and minor (draft) versions" on document library is definitely a right way to go :) But the problem usually fall in one of following two scenarios

Scenario 1 - Missing value in InitiationType Element

Make sure in your workflow definition (workflow.xml) you have included OnMajorCheckIn in <InitiationType>. For example

[code:xml]

<MetaData>
    <InitiationType>Manual;#OnNewItem;#OnItemUpdate;#OnMajorCheckIn
    </InitiationType>
</MetaData>

[/code]

MSDN - "If you do not specify an InitiationType element, Windows SharePoint Services treats the workflow as if the Manual, OnNewItem, and OnItemUpdate values have been specified"

Scenario 2 - The option is enable to you, but you can't select it.

Since "major and minor versions" only supported in Document Library. "Start this workflow to approve publishing a major version of an item" option was never meant to work with List. So make sure you only associate your custom workflow to Document Library if you want it to work. If you do it via code, make sure this is how you do it:

[code:c#] SPList _list = _spweb.Lists["Documents"];
SPDocumentLibrary docslib = (SPDocumentLibrary)(_list)
//Add workflow to document lib not list
docslib.AddWorkflowAssociation(yourWorkflow);
[/code]

 

Hope it helps

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: , ,

SharePoint

Comments

Powered by BlogEngine.NET 1.4.5.0
Theme by Mads Kristensen Adopted by James Tsai

About the author

Name of author James Tsai
.NET / SharePoint Consultant
Columbus, OH

E-mail me Send mail

Calendar

<<  March 2010  >>
MoTuWeThFrSaSu
22232425262728
1234567
891011121314
15161718192021
22232425262728
2930311234
View posts in large calendar

Certifications

MCPD
MCTS

Recent comments

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2010

Sign in