Search code examples
sharepointmosssharepoint-2007

CAML cannot reference Custom Properties in custom fields


I am trying to create a custom field type in SharePoint. My custom field type has a custom property called CustomProperty.

<FieldTypes>
  <FieldType>
    <Field Name="TypeName">CustomField</Field>
    <Field Name="InternalType">CustomField</Field>
    ..............................
    ..............................
    <PropertySchema>
      <Fields>
        <Field Name="CustomProperty" DisplayName="CustomProperty" Type="Text" Hidden="TRUE" />
      </Fields>
      <RenderPattern Name="DisplayPattern">
      <Property Select="CustomProperty" />
    </RenderPattern>
  </FieldType>
</FieldTypes>

I am trying to render the value of this custom property in the DisplayPattern.

But it looks like the CAML is not able to reference the custom properties.

I am not getting any value for the CustomValue property even though it is set correctly.

Any idea how to refer custom properties in CAML?


Solution

  • Unfortunately there is no straightforward way of achieving this, from what I've seen.

    Your best option is to look at using this.GetCustomProperty("CustomProperty") within the overrided GetFieldValue function (or GetFieldValueAsHtml for a Note field).

    The value string passed into the GetFieldValue function is the output from your CAML, so you can append to it and pass it on out.