I have a pretty simple BCS model:

public Guid Id { get; set; }
public SPFieldUrlValue Url { get; set; }
public string Description { get; set; }
public string Owner { get; set; }
public DateTime CreatedOn { get; set; }

The Url property contains both the Title and URL like any SharePoint Hyperlink property. The BCS model has the following Type Descriptor for both the ReadList and ReadItem methods:

<TypeDescriptor Name="Url" TypeName="Microsoft.SharePoint.SPFieldUrlValue">
        <Property Name="SPCustomFieldType" Type="System.String">`URL</Property>

In the list definition's schema.xml I have the following values for the Fields collection:

<Field Name="BdcIdentity" DisplayName="BDC Identity" Hidden="FALSE" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="BdcIdentity" Type="Text" />
<Field Name="Id" DisplayName="Id" Hidden="FALSE" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="Id" Type="Text" />
<Field Name="Url" DisplayName="Url" Format="Hyperlink" Hidden="FALSE" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="Url" Type="URL" />
<Field Name="Description" DisplayName="Description" Hidden="FALSE" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="Description" Type="Text" />
<Field Name="Owner" DisplayName="Owner" Hidden="FALSE" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="Owner" Type="Text" />
<Field Name="CreatedOn" DisplayName="Created On" Hidden="FALSE" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="CreatedOn" Type="DateTime" />

Nothing too fancy. When I open up the default view, however, it does not display the URL properly in the table view - it displays nothing. In the individual item view it does display properly. Any thoughts on how to get an SPFielidUrlValue to render properly on the UI?

  • 1
    PSS has confirmed that this is a bug - waiting on resolution. Jan 9 '11 at 20:27
  • 1
    Design change request to fix the bug was rejected by the product group (shakes fist at SharePoint); PSS is now looking into alternatives. Jan 13 '11 at 21:51

After two and a half months (!!!!) PSS was able to come up with a workaround using a custom XML stylesheet that gets stored in Layouts/Xsl:

<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='Url' and @Format='Hyperlink']" mode="URL_body" priority="1">
    <xsl:param name="thisNode" select="."/>
    <xsl:variable name="url" select="normalize-space(substring-before($thisNode/@*[name()=current()/@Name],','))" />
    <xsl:variable name="desc" select="normalize-space(substring-after($thisNode/@*[name()=current()/@Name],','))" />
    <xsl:variable name="descfld" select="$thisNode/@Description"/>
    <xsl:variable name="urlfld" select="$thisNode/@Url"/>
    <!--  URL: <xsl:value-of select="$urlfld" /><br/>
          Description: <xsl:value-of select="$descfld" /><br/>
      Link: -->
    <a href="{$url}" alt="{$desc}">
      <xsl:value-of select="$desc"/>
  • Colin, Sorry for interupting u... But i can't figure out a way to do this... Pasting this code in the main.xsl works fine! But when i put this code in myFile.xsl it doesnt pick up my code... Are you 100% sure you didn't add any connection to this new file at all? Thanks Mar 30 '11 at 15:10
  • Well, u can set XslLink in your XsltListViewWebPart or XsltListFormWebPart which are used for display list of item of BSC entity. Just open needed pages with SharePoint Designer and customize xslt. We've used this way and everything work good.
    – user656
    Aug 26 '11 at 8:24
  • @FrederikPrijck name it fldtypes_somename.xsl and it will get picked up automatically.
    – Bart
    Nov 16 '11 at 11:49

According to the MSDN page BDC Custom Properties:

This property has no effect on methods other than the SpecificFinder.


I am wondering, how can i implement this xsl? Offcourse i can create it, and deploy it into layouts/xsl... But there is no connection between the external list and the xsl file ?

  • All I did was deploy it to /_layouts/xsl and it picked up my field named "Url". Mar 25 '11 at 11:55
  • So you just create a file named "myxsl.xsl" and u just paste it in that folder ? Without refering to it somewhere ? And that file only contained the code you are mentioning ? (so nothing else that is described in main.xsl or so) Mar 25 '11 at 12:38

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.