Hi,
I've just installed Sharepoint 2013 and started to play around with it. Seems to be many improvements - among these are the ability to create Display templates.
On my publishing page there is a default "employee lookup" app which returns prefferred name, title and department as default when I try to search.
I would love to return mobile number aswell so I have tried to do the following:
I made a copy of Display _Catalogs/Masterpages/Display Templates/Search/Item_Person.html
Edited that one with the following:
1. Added 'MobilePhone':'MobilePhone' to the "Managed Property mapping" in the top of the html document:
<mso:ManagedPropertyMapping msdt:dt="string">'AboutMe':'AboutMe','AccountName':'AccountName','BaseOfficeLocation':'BaseOfficeLocation','Department':'Department','HitHighlightedProperties':'HitHighlightedProperties','Interests':'Interests','JobTitle':'JobTitle','LastModifiedTime':'LastModifiedTime','Memberships':'Memberships','MobilePhone':'MobilePhone','PastProjects':'PastProjects','Path':'Path','PictureURL':'PictureURL','PreferredName':'PreferredName','Responsibilities':'Responsibilities','Schools':'Schools','ServiceApplicationID':'ServiceApplicationID','SipAddress':'SipAddress','Skills':'Skills','UserProfile_GUID':'UserProfile_GUID','WorkEmail':'WorkEmail','WorkId':'WorkId','YomiDisplayName':'YomiDisplayName'</mso:ManagedPropertyMapping>
2. Set a var in the <body> with:
var has_MobilePhone = !$isEmptyString(ctx.CurrentItem.MobilePhone);
Created the following based on "DepartmentField":
if(has_MobilePhone == true) { _#--> <div id="MobilephoneField"> <!--#_ var encodedMobilePhone = $htmlEncode(ctx.CurrentItem.MobilePhone); var displayMobilePhone = Srch.U.getSingleHHXMLNodeValue(hhProps, "MobilePhone"); if ($isEmptyString(displayMobilePhone)) { displayMobilePhone = encodedMobilePhone} _#--> <div id="MobilePhoneValue" class="ms-srch-ellipsis" title="_#= encodedMobilePhone =#_"> _#= displayMobilePhone =#_ </div> </div> <!--#_ }
Saved the document to the masterpage galary and edited the search result page to (people search core results webpart) to "use a single template to display items" and selected my display template.
Now the search result is still working but I get no mobile numbers to show up in the user info (only in the details which is default).
Anyone has some bright ideas of what i'm missing?. I'm not used to code (which might be the cause :-)). If you also have an idea on how to make the value of the number = Mobile: <mobilenumber>. So the "Mobile:" static text is displayed aswell.
Thanks a lot for your time.
- Edited by Jan Knudsen Friday, November 09, 2012 9:14 AM Cellphone should be MobilePhone