Sharepoint Designer: Fetching ID of Lookup Field from Label

In sharepoint , on display pages of any list, all the fields are rendered as Label, This creates problem when customization is required having some link of lookup field( rendered as label) from that page.

Since it is label @lookupfieldname returns the value(in text format) of that field not ID for that field value.

For this there is inbuilt function called ddwrt:URLLookup with arguments in following order:

  • GUID of List from which that lookup field belongs
  • Display name of lookup field for current list
  • string(@ID) is to bind value with currrent id of item displayed from current list

so in sample case function for that lookupfield will look like

ddwrt:URLLookup(‘{218F74EE-A2C0-4D22-B8E1-BD91B2F36437}’,’MyContact’, string(@ID)))


  • The GUID is the ListId of the Contacts List (change accordingly !)
  • ‘MyContact’ is the internal field name of the lookup field created in the custom list (change accordingly !)
  • @ID passes the reference to the current item for which you want to get the lookup item url


  1. Daniel said,

    February 20, 2010 at 2:01 AM

    That’s great but is that suppose to work with MOSS 2007? I always get the same @ID value using the ddwrt:URLLookup command. Am I doing something wrong?

  2. Mark said,

    February 25, 2010 at 7:29 PM

    I got this working with a custom DispForm I was making (to display a calendar list, with the lookup pointing to a “Locations” list that would provide directions).

    I am now trying to use this with a Content Query Web Part to accomplish something similar but I am getting nothing back (I have already created my custom CQWP so I am getting the Lookup text value back but this code doesn’t return a value, so the link wont’ work.

    Is it possible to get the ID value of a lookup field using the CQWP in order to link to the list the lookup is being pulled from?

    This is a desperate request….I have a deadline coming up in a few days and I can’t get this one thing working.

  3. March 22, 2010 at 5:20 PM

    It returns always a first item Lookup Url for all the items (if we have multiple items). Is there any work around to get the respected Url values for the respected Item?

  4. May 15, 2013 at 2:51 AM

    This site was… how do I say it? Relevant!! Finally I have found something which helped me.

  5. May 17, 2013 at 12:29 AM

    Overall, if you need more storage capacity, then you should definitely
    get yourself a 6th Generation i – Pod Classic.

    Once decided on the things to bring, start packing.
    Whenever you rent a book from them, they plant a tree to show the benefits of renting books.

  6. May 17, 2013 at 8:00 AM

    3 maximum aperture, fixed lens mount, auto focus features, 2.
    Samsung M620 Black mobile is just big enough
    to display four icons side by side and measures only 1.
    The Fujifilm Fine – Pix x100 is generally considered a professional compact rangefinder

  7. May 27, 2013 at 11:08 AM

    Get hold of a Hawaiian shirt (I bet you’ve got one of these as well. Once decided on the things to bring, start packing. There are a lot of options in mobile phones available on the market today.

  8. venezuela said,

    June 3, 2013 at 11:09 PM

    I love your blog.. very nice colors & theme. Did you create this website yourself or did you hire someone to do it for you?
    Plz reply as I’m looking to construct my own blog and would like to know where u got this from. appreciate it

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: