I have lists of a special item content type that I list using search. These list contain for instance a column of type Person or Group. In the lists the columns are being displayed as "Name (with picture and details)".

But with my display template I am just getting a long string displayed with the following info: "email address | Name | lots of digits i:0#.w|domain\account name"

I have read this article http://www.ableblue.com/blog/archive/2013/06/05/add-presence-to-sharepoint-search-results/ and it seems really nice to be able to display the name with a presence indicator, but I´ll be happy if I´d just get the name displayed in a nice way.

In the article it seems like he is working with another kind of object. All I have to work with is a managed property ManagerOWSUSER mapped to the column that I access using ctx.CurrentItem.ManagerOWSUSER

I guess I could do some string manipulation to find the name part. But I wonder if there is some proper object model to work with in this case? There seem to be many issues similar to this with search display templates.

1 Answer 1


Try the below function.


In your case,


I haven't tried it on a custom Person/Group column.

  • Srch.U was a useful toolbox! getDisplayNameFromAuthorField seems to work on custom Person column. I also tried adding presence indicator using the code found in the link above. Indicator displays OK, but it only works good for results where I have only one item. If I have multiple results all result items get the same Manager as the last item in the result list.
    – Gunilla
    Feb 5, 2016 at 13:23
  • You have to create a unique ID for the div. In that code I have a unique ID for the UserPersona. var userPersonaId = $htmlEncode(id) + "_peopleUserPersona"; more than likely you are not creating uniqu IDs. Feb 7, 2016 at 15:53
  • Thanks! I reviewed my variables, and it seems like I was assigning the variable uName only once and not for each item. Instead I was setting another variable that was not even being used... Now it is working as expected.
    – Gunilla
    Feb 8, 2016 at 9:44
  • Can you post the presence code? Aug 13, 2018 at 20:44

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.