This should be an easy one but for some reason the answer is escaping me.
I am executing a query with joins that includes projected fields (fields from one of the joined lists) using JSOM.
Using server side code, the type of one of these field values is String and has a value in the format of "ID;#Value".
Using JSOM, how do I get the value of this field? When I call the .toString() method on the field value, I get "[object Object]". If I call typeof() on the field value, I get "string". What am I missing?
* UPDATE *
The following appears in the query XML...
<ProjectedFields>
<Field Name="LastName" Type="Lookup" List="Employees" ShowField="LAST_NAME" />
</ProjectedFields>
<ViewFields>
<FieldRef Name="LastName" />
</ViewFields>
The following server-side code...
listItem["LastName"]
...will yield something like "1;#Smith".
The following client-side code...
listItem.get_item('LastName')
...will yield "[object Object]". The type of this field value is indeed string (just as it was for the server-side code) as evidenced by the statement...
typeof(listItem.get_item('LastName')
...which yields "string".
Again, the question is how do I get the value "1;#Smith" using the client-side code?