3

I am struggling with grabbing the text from a lookup column. The field contains a link with text, and in my JS code, I would like to access the field's text contents (not the link).

If I use oListItem.get_item("columnName"), the return value is an object (console prints [Object object]). I noticed on some forums, there was a method get_fieldValuesAsText(). Link here

This method, in theory would return the text value in the column in question. My question, is will this work, and, where can I find some examples of using this.

5

For getting lookup value use this:

var columnFieldValue = oListItem.get_item("columnName");
var lookupValue = columnFieldValue.get_lookupValue();
var lookupId = columnFieldValue.get_lookupId();
  • When i added this line it says get_lookupValue() isn't a function? – Sabien Ambrose Aug 18 '16 at 16:01
  • is field "columnName" lookup? Or it has another type? If it's hyperlink type use .get_description() and .get_url() – Semushin Dmitrii Aug 19 '16 at 6:10
  • it only worked like this: Picture += oListItem.get_item("PictureName").get_lookupValue(); – Sabien Ambrose Aug 19 '16 at 18:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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