Monday, May 13, 2013

Projected Field in View Item Form

Scenario
  • You are using Projected Fields (a.k.a. additional columns) from a lookup column in a list or library. 
    • This may be a standard lookup column or a BCS External Data column.
  • You would like these fields to show up on the list/library display (View Item) form.
Issue
  • Normally you will only see projected fields in list views configured to display these columns.  For some reason, MS did not include them by default on the display form.
Resolution
  • Add these fields below the standard item form.
    • The form will continue to be dynamic since the standard Data Form Web Part is still used for all other fields
      • Example: A new column added to the list will automatically show up on this customized display form.
Steps
  • Create a New Form in SharePoint Designer on the appropriate list/library.
    clip_image001
  • Set the File Name to "DispFormWithAdditionalFields", Type to Display item form, and set as default
    clip_image002
  • Temporarily Insert a Display Item Form in the div Below the existing content
  • This will populate the Data Source Details window. Open this window if not already visible. Data view Tools (ribbon) / Options / Data Source Details (Data section)
    clip_image003
  • Right click on the Projected Field you wish to display, right click it, then select Copy Item XPath
    clip_image004
  • Now delete the temporary Display Item Form. This was just used to populate the Data Source Details window.
  • Insert a SharePoint ListItemProperty control (Insert / Controls / SharePoint) at the same location
    clip_image005
  • Right click the control and edit properties.
  • In the Tag Properties window Set the Property property. :)
    • Paste the XPATH copied earlier and delete everything up to the @ sign
      • /dsQueryResponse/Rows/Row/@Exam_x0020_Number_x003a__x0020_Company_Name
      • Change to: Exam_x0020_Number_x003a__x0020_Company_Name
  • Add a column header above or to the left of the new field.
  • Save and Preview in Browser
    clip_image006
    (names removed in image)
  • Enjoy!

No comments:

Post a Comment