5

I have developed a custom field type which will show the link to the "workflow history list" in the list (It's a column in the list).

It works fine in sharepoint 2007 site. when i migrate the code to sharepoint 2010, everything works fine but in list view the link is appearing as text with all HTML formatting.

In Display form it works fine. But in list view it displays all the href values, when I put CAMLRendering true in my xml file. how I can overcome it. i read that i need to create a .xsl file for it as the render pattern is obsolete and it will not work for list views.

any help is appreciated.

1 Answer 1

4

The RenderPattern is obsolete starting from version 14 (SharePoint 2010). So, RenderPattern does not affect how Field is rendered in List View.

In order to define Custom Rendering for a Custom Field, please see How to: Customize the Rendering of a Field on a List View


Brief description.

  1. Create XSLT style sheet for rendering a custom field type. In your case XSLT style sheet would look like shown below:

    <xsl:stylesheet xmlns:x="http://www.w3.org/2001/XMLSchema"
                    xmlns:d="http://schemas.microsoft.com/sharepoint/dsp"
                    version="1.0" exclude-result-prefixes="xsl msxsl ddwrt"
                    xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime"
                    xmlns:asp="http://schemas.microsoft.com/ASPNET/20"
                    xmlns:__designer="http://schemas.microsoft.com/WebParts/v2/DataView/designer"
                    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                    xmlns:msxsl="urn:schemas-microsoft-com:xslt"
                    xmlns:SharePoint="Microsoft.SharePoint.WebControls"
                    xmlns:ddwrt2="urn:frontpage:internal">
      <xsl:template match ="FieldRef[@Name='YourCustomFieldInternalName']" mode="URL_body">
        <xsl:param name="thisNode" select="."/>
        <!-- Hyperlink for History List goes here --> 
      </xsl:template>
    </xsl:stylesheet>
    

    Note: a)you have to specify match attribute, so that the template matches only fields with the exact internal name of your custom field match="FieldRef[@Name='YourCustomFieldInternalName']" Also instead of Field Internal Name you could specify match attribute for Field ID, like this match="FieldRef[@ID='5a14d1ab-1513-48c7-97b3-657a5ba6c742']"

    b)you have to specify correct mode. It value depends on the Field type, use the following mapping info as guidance: SPFieldComputed (Computed_body), SPFieldUser(User_body), SPFieldText(Text_body) and etc.

  2. Save your XSLT stylesheet, I recommend to use the following naming convention:

    fldtypes_YourFieldTypeName.xsl

  3. Deploy it to %ProgramFiles%\Common Files\Microsoft Shared\web server extensions\14\TEMPLATE\LAYOUTS\XSL

1
  • 1
    I didn't find any information about 1.b) elsewhere so this was pretty helpful, however I needed to change @Name to @FieldType to work in my case. Maybe someone will find it helpful. Commented Aug 3, 2014 at 8:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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