SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In my SharePoint JavaScript code, I am retrieving items from a list in my SP 2010 environment. I used a camel query to download specific fields. One of the fields was created by (person who created the item). When I loop through the items, I get the value of the created by field, and if I try to insert it into the dom, it says [object Object].

So I think there is a method I need to call on that object how I don't know what it is. I just want to get the display name from it as a string.

Does anyone know how?

share|improve this question
Can we see some of your code? Perhaps it is an spuserobject and you need to get the name property. var user = yourobject.Name ? – BlueBird May 17 '13 at 19:52
Well I am getting the field using the column name Author. Also is there a way using any developer tools, to see what the datatype of this object is? – omega May 17 '13 at 20:20

I got it, you need to use this method .get_lookupValue().

share|improve this answer

You need to call the right field...

    function findItems()
    var soapEnv =   "<soap:Envelope xmlns:soap=''> <soap:Body>" + 
                    "<GetListItems xmlns=''>" +
                        "<listName>listNameHere</listName>" +
                        "<query> <Query> <Where>" +
                            "<Eq> <FieldRef Name='Assignee'/> <Value Type='Text'>" + variableName+ "</Value> </Eq>" +
                        "</Where> </Query> </query>" +
                        "<viewFields> <ViewFields> <FieldRef Name='Title' /> </ViewFields> </viewFields>" +
                        "<rowLimit>99999</rowLimit>" +
                        "<queryOptions xmlns:SOAPSDK9='' > <QueryOptions/> </queryOptions>" + 
                    "</GetListItems>" +
                "</soap:Body> </soap:Envelope>";
    url: "/_vti_bin/lists.asmx",
    type: "POST",
    dataType: "xml",
    data: soapEnv,
    complete: ProcessListItems,
    contentType: "text/xml; charset=\"utf-8\""

function ProcessListItems(xData, status) {
    var createdBy;

    $(xData.responseXML).find("z\\:row").each(function () {
        createdBy= $(this).attr("ows_Author");

The createdBy variable at the end, for example, will be the person who created the item. ows_Editor should be the last "Modified By" person

share|improve this answer
I am coding it different, I am doing it like the examples from – omega May 17 '13 at 18:45

Your Answer


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.