I have build a workflow using SharePoint Designer and attached it to a document library. The workflow itself is working with no problem.

In the library, if I add the workflow column to the view, I can see the link with the current state as the label, and the link href is :


There is in the query string both library's ID and WF instance ID, which is fine.

On my home page, I added the webpart of this library, and set up the view to group by the workflow column and to view the workflow column. Visually it's ok, but the link generate for the column is :


As you can see, the List argument is not populated.

With no surprise, when I click on the link, I got this error :

Server Error in '/' Application.

Index was outside the bounds of the array. 
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.IndexOutOfRangeException: Index was outside the bounds of the array.

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.  

Stack Trace: 

[IndexOutOfRangeException: Index was outside the bounds of the array.]
   Microsoft.SharePoint.ApplicationPages.WrkStatPage.SetCamlVariablesFromQueryString(ListViewByQuery listViewByQuery, String queryString) +725
   Microsoft.SharePoint.ApplicationPages.WrkStatPage.OnLoad(EventArgs e) +5027
   System.Web.UI.Control.LoadRecursive() +66
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2428

What should I do to add, in the home page, a link to the status of the workflow of my item ?


I've run into this well, and posted a solution on my blog a while back: http://www.danielroot.info/2010_07_01_archive.html

It's nuts Microsoft hasn't fixed this. I'm looking for a better solution, but until then, if you really want to fix:

Open the site in sharepoint designer, edit homepage (or, whatever page has the issue) place the text cursor in the Workflow Status cell that has the bug type ‘test’ – this is to break into custom xslt, and to help you mark where to place the snippets.

Switch to split view, Find the <td></td> that contains some xslt and the word ‘test’. Your cursor should be there already. Replace everything between the <td></td> with Snippet 2.

Add Snippet 1 to the bottom of the stylesheet, immediately before Remove the word ‘test’ that you typed, if you didn’t replace it above


Snippet 1

<xsl:template name="string-replace-all">
  <xsl:param name="text" />
  <xsl:param name="replace" />
  <xsl:param name="by" />
    <xsl:when test="contains($text, $replace)">
      <xsl:value-of select="substring-before($text,$replace)" disable-output-escaping="yes" />
      <xsl:value-of select="$by" disable-output-escaping="yes" />
      <xsl:call-template name="string-replace-all">
        <xsl:with-param name="text" select="substring-after($text,$replace)" />
        <xsl:with-param name="replace" select="$replace" />
        <xsl:with-param name="by" select="$by" />
      <xsl:value-of select="$text" disable-output-escaping="yes" />

Snippet 2

<xsl:if test="@ClassInfo='Menu' or @ListItemMenu='TRUE'">
  <xsl:attribute name="height">100%</xsl:attribute>
  <xsl:attribute name="onmouseover">OnChildItem(this)</xsl:attribute>
<xsl:attribute name="class">
  <xsl:call-template name="getTDClassValue">
    <xsl:with-param name="class" select="$class" />
    <xsl:with-param name="Type" select="@Type"/>
    <xsl:with-param name="ClassInfo" select="@ClassInfo"/>
<xsl:variable name="workflowStatusLink">
  <xsl:apply-templates select="." mode="PrintFieldWithECB">
    <xsl:with-param name="thisNode" select="$thisNode"/>
<xsl:variable name="workflowStatusLinkFixedUp">
  <xsl:call-template name="string-replace-all">
    <xsl:with-param name="text" select="$workflowStatusLink" />
    <xsl:with-param name="replace" select="'List='" />
    <xsl:with-param name="by" select="''" />
<xsl:value-of select="$workflowStatusLinkFixedUp" disable-output-escaping="yes"/>
  • Thanks :) A new item in the (too long) list of obscur behavior of SharePoint – Steve B Feb 16 '12 at 8:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.