Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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 :

http://sites/_layouts/WrkStat.aspx?List=a682b3a2-803c-4ec8-b98a-95dc518066ce&WorkflowInstanceID=%7b722C16D6%2d20EA%2d4952%2dAF5F%2dB213201593F3%7d

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 :

http://sites/_layouts/WrkStat.aspx?List=&WorkflowInstanceID=%7b722C16D6%2d20EA%2d4952%2dAF5F%2dB213201593F3%7d

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 ?

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

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

Save

Snippet 1

<xsl:template name="string-replace-all">
  <xsl:param name="text" />
  <xsl:param name="replace" />
  <xsl:param name="by" />
  <xsl:choose>
    <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:call-template>
    </xsl:when>
    <xsl:otherwise>
      <xsl:value-of select="$text" disable-output-escaping="yes" />
    </xsl:otherwise>
  </xsl:choose>
</xsl:template>   

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:if>
<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:call-template>
</xsl:attribute>
<xsl:variable name="workflowStatusLink">
  <xsl:apply-templates select="." mode="PrintFieldWithECB">
    <xsl:with-param name="thisNode" select="$thisNode"/>
  </xsl:apply-templates>
</xsl:variable>
<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:call-template>
</xsl:variable>
<xsl:value-of select="$workflowStatusLinkFixedUp" disable-output-escaping="yes"/>
share|improve this answer
    
Thanks :) A new item in the (too long) list of obscur behavior of SharePoint –  Steve B Feb 16 '12 at 8:45
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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