My 2p about ERP Solutions, Information Worker Solutions and other software products (mainly Microsoft Dynamics AX and Microsoft SharePoint).

23 December 2008

Show ID field on the DispForm.aspx form page

by Patrik Luca 9 comments

Tag



Business requirement: Show ID field on the DispForm.aspx page


The ID field of a SharePoint list is not shown by default on the DispForm.aspx form page. This can be very annoying, especially in cases where an Issue Tracking list is used: most of the time business users want to see the ID for an Issue Tracking list item.


Solution: Create a shadow ID field


  1. Create a site column CopyID (Number, Number of decimal places: 0)
  2. Add the CopyID column to the site content type Issue.
  3. Create an Issue Tracking list.
  4. Open the site in which the Issue Tracking list is created with Microsoft Office SharePoint Designer.
  5. Start creating a new Workflow (File > New > Workflow) attached to the Issue Tracking list. Let the Workflow start automatically when a new Issue Tracking list item is created.



  6. Assign the value of the ID field to the CopyID field.

     
  7. Use the tool SharePoint Tips Utility Pack to change the rendering of the CopyId field on the form pages (for more information, see Hide list fields upon creation of a SharePoint list item): Show the CopyId field in the Display Form, but not in the New nor Edit Forms. Change the Field Name to ID.

     

Upon creation or editing a Issue Tracking list item, the ID field is not shown:

Upon displaying a Issue Tracking list item, the ID field is shown. In fact this ID field, is the previously named CopyId field, which receives the value automatically from the system ID field upon creation of a new Issue Tracking List item thanks to the previously created Workflow. We need to work with a shadow ID field, as it seems not possible to render the system ID field on the DispForm.aspx page, even not with the SharePoint Tips Utility Pack: it seems as if the properties to render it on a DispForm.aspx page don't work for the system ID field. That is why I've chosen here to use a shadow field.

Comments 9 comments
C Josh Doll said...

Why would you not just create a site column called "Issue ID" and make it a calculated value "=ID", and not display it on any views. Since its calculated, it will not show on new or edit pages, but will show on item details.

C Josh Doll said...

Answered that question...it zeros out the field on edit...

There HAS to be a better way to do this, I have numerous lists, and it used to show this in 2.0.

Maybe some scripting to pull it out of the URL.

Patrik Luca said...

Hi Josh,
feel free to share it here if you find a better way: I am looking forward to it.

C Josh Doll said...

Well I am working on another way, but it is only slightly less laborious. By creating a custom list webpart and hiding the default webpart, it would appear you can throw the ID in there. But that still means editing EVERY list, which just isnt feasible.

I'm going to dig, I am pretty sure somewhere I came across a way to populate a field from the URL, and since the URL contains the record number, you should be able to pull that down.

At least that would only require a content editor webpart on each list referencing some saved code.

We shall see...hopefully I'll get something. This is just an issue that will always be present in my environment on every list, and coming from WSS 2.0 where it was there, the users want it back!

Wear Football Team said...

This post have really neat solution. It uses the URL to grab the id and place it in the page. really cool.

http://pathtosharepoint.wordpress.com/2009/01/18/item-id-in-display-and-edit-forms/

HTH,
Nilesh Vasave

Anonymous said...

I created a new calculated field and set it to the value "=ID" and display that on the form and it works well.

kobikobi said...

@Anonymous - the calculated field trick was also my first idea, but is stopped working after a few days (!).
The workflow way is less destructive than editing the display form, and what I end up doing too.

Kevin Johnson said...

Does anyone have any advice on how to add the field descriptions that show in the Edit and New Forms, to the Display form?

Some of the field names I have in a list are quite short, and really require the descriptions:

href="http://www.amphibianark.org/Image2.jpg"

The display form, which most visitors to the site see, could really do with these descriptions:

href="http://www.amphibianark.org/Image1.jpg"

Any help would be very much appreciated.

Kevin
kevinj@amphibianark.org

Anu said...

Hi,

I have an existing list to which I wanted to add this. (display the Issue ID when user view it in Edit or Display more). I tried to follow your steps. Created the site column and added the column to the site content type of Issue. However, when I create the workflow in designer, I am not able to see the CopyID column I created (Step 6 in your article). Any idea why it is so?

Patrik Luca, Ieper, BELGIUM
Feel free to use or spread all of the content on my blog. In return, linking back to my blog would be greatly appreciated. All my posts and articles are provided "AS IS" with no warranties.

Subscribe feeds via e-mail
Subscribe in your preferred RSS reader

Subscribe feeds rss Most Read Entries

Subscribe feeds rss Recent Entries

Categories

Recommended Books


Subscribe feeds rss Recent Comments

This Blog is part of the U Comment I Follow movement in blogosphere. Means the comment field of this blog is made DOFOLLOW. Spam wont be tolerated.

Live Traffic Feed

Recent Visitors

Blog Archive

My Blog List

Followers

Guest Links