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?

  • 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
    Commented May 17, 2013 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
    Commented May 17, 2013 at 20:20

2 Answers 2


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


You need to call the right field...

    function findItems()
    var soapEnv =   "<soap:Envelope xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'> <soap:Body>" + 
                    "<GetListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'>" +
                        "<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='http://schemas.microsoft.com/sharepoint/soap/' > <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


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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