Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Related: How to retrieve a ListItem using the Javascript Client Object Model?

In my previous question I was able to successfully retrieve a basic value from a list item. My problem is that I am now trying to retrieve a value from a LookUp column get_item no longer seems to work.

When I do an alert, I get [object Object] instead of the value that is in there.

Code I am using:

function onSuccess(sender, args) {
        alert(oDeptItem.get_item('Department'));
        $('#contact').html(oDeptItem.get_item('Department'));
    }

Should I be using somethign besides get_item to values from LookUp columns?

share|improve this question
    
get_lookupValue() will also work with fields of Type "User" –  Vardhaman Deshpande Aug 30 '11 at 5:59
    
What about columns that belongs to the lookup field? For example Department name, Department No and so on. –  Rob Jan 20 at 12:50
add comment

1 Answer

up vote 10 down vote accepted

Looks like I just needed to add the get_lookupValue() function after my get_item call:

alert(oDeptItem.get_item('Department').get_lookupValue());

Hope this helps someone...

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.