Display Template - Assistant PreferredName

Hi
I need to customize the people search results hover panel to display the Assistant preferred name. 
I've already got a custom display template for people item and hover panel in place. I'm currently getting back the assistant using the ManagedPropertyMapping using 'Assistant':['Assistant'] and this displays the assistants' login id domain\username. I'm
assuming this is correct, as this is what would be stored against the user profile assistant property.
I need to now display the assistants' PreferredName instead and I'm not sure how to proceed. I'm assuming I need to re-query the people manager to get back the preferred name.
I can get the preferred name using the api: 
schema://server/_api/SP.UserProfiles.PeopleManager/GetUserProfilePropertyFor(accountName=@v,propertyName='PreferredName')?@v='domain\username'
I'm looking for best practice approach to complete this in the display template hover panel.
Any pointers, guidance or information would be greatly appreciated.
Kind regard,
Lee

Hi,
According to your post, my understanding is that you wanted to add the PreferredName managed property in the custom people search hover panel.
To add fields in people search hovel panel, we should modify the Item_Person.html and Item_Person_HovelPanel.html.
It means, you should modify two place, your custom Item_Person.html page, and Item_Person_HovelPanel.html page.
Then we should first add the fields in the Item_Person.html. In the ManagedPropertyMapping tag, use the following syntax to add the custom managed properties that you want to display: 
'<Current item property name>':<Managed property name>'
Then add your  properties in the Item_Person_HoverPanel.html like below(I use the MobilePhone managed property).
<div style="color:#000000; display:inline">Mobile Phone:</div>_#=ctx.CurrentItem.MobilePhone=#_<br>
More reference:http://blogs.technet.com/b/tothesharepoint/archive/2013/09/17/how-to-display-values-from-custom-managed-properties-in-the-hover-panel-in-sharepoint-server-2013.aspx
Thanks,
Jason
Forum Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
[email protected]
Jason Guo
TechNet Community Support

Similar Messages

  • SharePoint 2013 Search Display Template People Search Mobile Phone

    Hello,
    I'd like to customize the people search result page. I already added some custom profile properties without any problem. But, when adding the MobilePhone field nothing is display.
    I've created a new display template based on the "Item_Person.html" file. 
    Added the "MobilePhone" field in the ManagedPropertyMapping section
    <mso:ManagedPropertyMapping msdt:dt="string">&#39;WorkPhone&#39;:&#39;WorkPhone&#39;,&#39;MobilePhone&#39;:&#39;MobilePhone&#39;,&#39;Room&#39;:&#39;Room&#39;,&#39;Werkgebieden&#39;:&#39;Werkgebieden&#39;,&#39;AboutMe&#39;:&#39;AboutMe&#39;,&#39;AccountName&#39;:&#39;AccountName&#39;,&#39;BaseOfficeLocation&#39;:&#39;BaseOfficeLocation&#39;,&#39;Department&#39;:&#39;Department&#39;,&#39;HitHighlightedProperties&#39;:&#39;HitHighlightedProperties&#39;,&#39;Interests&#39;:&#39;Interests&#39;,&#39;JobTitle&#39;:&#39;JobTitle&#39;,&#39;LastModifiedTime&#39;:&#39;LastModifiedTime&#39;,&#39;Memberships&#39;:&#39;Memberships&#39;,&#39;PastProjects&#39;:&#39;PastProjects&#39;,&#39;Path&#39;:&#39;Path&#39;,&#39;PictureURL&#39;:&#39;PictureURL&#39;,&#39;PreferredName&#39;:&#39;PreferredName&#39;,&#39;Responsibilities&#39;:&#39;Responsibilities&#39;,&#39;Schools&#39;:&#39;Schools&#39;,&#39;ServiceApplicationID&#39;:&#39;ServiceApplicationID&#39;,&#39;SipAddress&#39;:&#39;SipAddress&#39;,&#39;Skills&#39;:&#39;Skills&#39;,&#39;UserProfile_GUID&#39;:&#39;UserProfile_GUID&#39;,&#39;WorkEmail&#39;:&#39;WorkEmail&#39;,&#39;WorkId&#39;:&#39;WorkId&#39;,&#39;YomiDisplayName&#39;:&#39;YomiDisplayName&#39;</mso:ManagedPropertyMapping>
    3. Added a variable:
    var has_MobilePhone = !$isEmptyString(ctx.CurrentItem.MobilePhone)
    4. Copied the "WorkPhone" display section and changed the values to MobilePhone
    <!--#_
    if(has_MobilePhone == true) {
    _#-->
    <div id="MobilePhoneField">
    <!--#_
    var encodedMobilePhone = ctx.CurrentItem.MobilePhone;
    var displayMobilePhone = Srch.U.getSingleHHXMLNodeValue(hhProps, "MobilePhone");
    if ($isEmptyString(displayMobilePhone)) { displayMobilePhone = encodedMobilePhone }
    _#-->
    <div id="MobilePhoneValue" class="ms-srch-ellipsis" title="_#= encodedMobilePhone =#_">MobilePhone: _#= displayMobilePhone =#_ </div>
    </div>
    <!--#_
    _#-->
    Unfortunally the mobilephone does not appear in my search results. 
    What did I missed?

    First of all thank you for this quick reply.
    I changed all the properties from MobilePhone to CellPhone, but without result.
    <mso:ManagedPropertyMapping msdt:dt="string">&#39;WorkPhone&#39;:&#39;WorkPhone&#39;,&#39;CellPhone&#39;:&#39;CellPhone&#39;,&#39;Room&#39;:&#39;Room&#39;,&#39;Werkgebieden&#39;:&#39;Werkgebieden&#39;,&#39;AboutMe&#39;:&#39;AboutMe&#39;,&#39;AccountName&#39;:&#39;AccountName&#39;,&#39;BaseOfficeLocation&#39;:&#39;BaseOfficeLocation&#39;,&#39;Department&#39;:&#39;Department&#39;,&#39;HitHighlightedProperties&#39;:&#39;HitHighlightedProperties&#39;,&#39;Interests&#39;:&#39;Interests&#39;,&#39;JobTitle&#39;:&#39;JobTitle&#39;,&#39;LastModifiedTime&#39;:&#39;LastModifiedTime&#39;,&#39;Memberships&#39;:&#39;Memberships&#39;,&#39;PastProjects&#39;:&#39;PastProjects&#39;,&#39;Path&#39;:&#39;Path&#39;,&#39;PictureURL&#39;:&#39;PictureURL&#39;,&#39;PreferredName&#39;:&#39;PreferredName&#39;,&#39;Responsibilities&#39;:&#39;Responsibilities&#39;,&#39;Schools&#39;:&#39;Schools&#39;,&#39;ServiceApplicationID&#39;:&#39;ServiceApplicationID&#39;,&#39;SipAddress&#39;:&#39;SipAddress&#39;,&#39;Skills&#39;:&#39;Skills&#39;,&#39;UserProfile_GUID&#39;:&#39;UserProfile_GUID&#39;,&#39;WorkEmail&#39;:&#39;WorkEmail&#39;,&#39;WorkId&#39;:&#39;WorkId&#39;,&#39;YomiDisplayName&#39;:&#39;YomiDisplayName&#39;</mso:ManagedPropertyMapping>
    var has_CellPhone = !$isEmptyString(ctx.CurrentItem.CellPhone)
    <!--#_
    if(has_CellPhone == true) {
    _#-->
    <div id="CellPhoneField">
    <!--#_
    var encodedCellPhone = ctx.CurrentItem.CellPhone;
    var displayCellPhone = Srch.U.getSingleHHXMLNodeValue(hhProps, "CellPhone");
    if ($isEmptyString(displayCellPhone)) { displayCellPhone = encodedCellPhone }
    _#-->
    <div id="CellPhoneValue" class="ms-srch-ellipsis" title="_#= encodedCellPhone =#_">CellPhone: _#= displayCellPhone =#_ </div>
    </div>
    <!--#_
    _#-->
    Can you please tell me what I need to change?

  • How to create a Display template for people search results

    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.

    Hello,
    I did the same with my new SharePoint 2013 (I would like to display the mobile phone too) but without any chance. Have you done anything else ?
    This is my User Property "CellPhone" :
    http://www.cladstrife.com/CellPhone_Prop.png
    The ManagedPropertyMapping :
    <mso:ManagedPropertyMapping msdt:dt="string">'AboutMe':'AboutMe','AccountName':'AccountName','BaseOfficeLocation':'BaseOfficeLocation','Department':'Department','HitHighlightedProperties':'HitHighlightedProperties','Interests':'Interests','JobTitle':'JobTitle','LastModifiedTime':'LastModifiedTime','Memberships':'Memberships','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','CellPhone':'CellPhone','HomePhone':'HomePhone'</mso:ManagedPropertyMapping>
    The "if_exist" variable :
    var has_cphone = !$isEmptyString(ctx.CurrentItem.CellPhone);
    And the "display" code :
    <!--#_
    if(has_cphone == true) {
    _#-->
    <div id="CPhoneField">
    <!--#_
    var encodedCPhone = $htmlEncode(ctx.CurrentItem.CellPhone);
    var displayCPhone = Srch.U.getSingleHHXMLNodeValue(hhProps, "CellPhone");
    if ($isEmptyString(displayCPhone)) { displayCPhone = encodedCPhone}
    _#-->
    <div id="CPhoneValue" class="ms-srch-ellipsis" title="_#= encodedCPhone =#_"> Mobile: _#= displayCPhone =#_ </div>
    </div>
    <!--#_
    _#-->
    If I delete the test lines in the display code (if(has_cphone == true) it show "Mobile:" but without any mobile number.
    Thanks for your help if any idea :)
    Best regards
    Gabriel

  • Insutrment: Rear & Display Template

     I have been searching the forums trying to get some of my questions answered and have come up with nothing.
    I have finally got labview and the Instrument I/O assistant all configured properly. So the software runs now. YAY!
    I have a Keithley 2182 with a thermocouple hooked up to it. I want to use the Rear and Display template to do some datalogging with one of our ovens. I haven't used Labview for 3 years. Can someone give me some advice on how I need to wire everything up in the template to start collecting data from the Keithley?
    Instrument I/O Assistant: When I try and use this to get data from the Keithley I get a Timedout error. I have the Keithley connected to the computer with a GPIB USB-HS.
    What am I missing with all this? Are there any tutorials or exmaples that I can look at and modify to work for my application? What I am doing is so simple and basic, I'm sure a generic template would be fine.

    Dennis,
     When I had the isntrument I/O assistant problem I was using Labview 8.2 student version. So I removed that and had our company purchase Labview 2010. So when I installed Labview 2010 and then downloaded the device driver software from the labview website, the Instrument I/O assistant worked fine.
     In regards to the Com3 Problem. I thought Com3 was my USB port number 3, which is where I assumed my GPIB-USB device was connected.
    I have attached a screen shot from my Device Manager. When I click ont he device it says, this device is working properly. Under the General tab it does say, Location 0 (USB Device). But I don't think that refers to the actual USB port number for my computer.
     What do you guys think? What am i doing wrong here.
    I WOULD LIKE TO THANK EVERYONE FOR THEIR HELP IN ADVANCE.
    Attachments:
    gpib-usb.jpg ‏411 KB

  • Get current logged in user in sharepoint 2013 hover display template

    Hi,
    Can somebody tell me how the current logged in username can be retreived in hover display template to be used in search result.
    i tried using rest api but that is very difficult to get as it is to be done using ajax call and if we do getting a return value asynchronous is difficult.
    Please help

    Hello,
    You might use the function used in the Visual Studio SharePoint App template:
    var context = SP.ClientContext.get_current();
    var user = context.get_web().get_currentUser();
    $(document).ready(function () {
    getUserName();
    function getUserName() {
    context.load(user);
    context.executeQueryAsync(onGetUserNameSuccess, onGetUserNameFail);
    function onGetUserNameSuccess() {
    $('#message').text('Hello ' + user.get_title());
    function onGetUserNameFail(sender, args) {
    alert('Failed to get user name. Error:' + args.get_message());

  • Error in Search results - Sorry, something went wrong. Display template had an error

    I'm receiving this error in custom search results page in our SharePoint 2013 Enterprise farm:
    Sorry, something went wrong.
    Display Error: The display template had an error. You can correct it by fixing the template or by changing the display template used in either the Web Part properties or Result Types.
    'console' is undefined (CoreRender: ~ sitecollection/_catalogs/masterpage/Display Templates/Search/Item_mycustom_Site.js
    I believe a similar error was resolved by March 2013 CU but our farm us running Aug 2013 CU. I have also tried adding domain to trusted zone in IE but still the same error.
    I do not get this error in Google Chrome or in IE 10 or above. Not sure if it is an issue with my display template because error disappears when upgrading IE to 10 or 11.
    Update: In IE 8 I can see search results with no error if the developer toolbar (F12) is enabled!
    -- The opinions expressed here represent my own and not those of anybody else -- http://manojvnair.blogspot.com

    Hi ,
    Did you try these steps
    Open up the SharePoint 2013 Management Shell as Administrator
    and run the following command:   Enable-SPFeature SearchWebParts -url http://<central admin
    url>
    Use a browser on a different machine, or add you SharePoint
    site(s) to the ‘Trusted Sites’ in IE.
    Activate the feature : “My
    Site Host“. This is a hidden feature scoped at the Site Collection level. The feature ID is 49571CD1-B6A1-43a3-BF75-955ACC79C8D8.
    The feature folder under SharePointRoot is MySiteHost.
    Install the update: http://www.microsoft.com/en-in/download/details.aspx?id=36989
    Here are some similar threads for you to take a look at:
    http://sharepoint.stackexchange.com/questions/70452/query-builder-for-result-source-not-working-in-central-admin
    http://www.thesharepointbaker.co.uk/sharepoint-2013-gotchas-2/
    http://bernado-nguyen-hoan.com/page/2/
    Ref:
    http://social.technet.microsoft.com/Forums/sharepoint/en-US/6e86cf3f-8001-4d13-a700-9e70d8828f03/controlsearchboxjs-not-found?forum=sharepointsearch

  • Item display templates office 365 not showing in sharepoint designer

    Hi,
    I have an enterprise search site in O365. I can brows to Masterpage > Display Templates > Search in the browser and see the .html & .js file.  If I brows to the same location in SharePoint designer, the files do not display.  How do I
    see/edit the files in SP designer?
    Thx!

    Hi Lorena,
    Add an image of the path, All Files (and pin button)->_catalogs->masterpage library.
    Thanks
    Daniel Yang
    TechNet Community Support

  • Access query strings in a search results page with custom display template

    am trying to create a  custom display template in my search results page , so i went to download the itemdefault html file and renamed it and  saved as  different file.and  am started to updating.
    the issue i am facing here is : in my  search results page there are 2 query strings, which are passed by anotehr .net appln[ another asp.net appln will be sending the query string to my sp 2013 search results page]
    but, how can i  read these 2  query strings using jslink and  new token _#- ? 
             <!--#_
               var QStringResults= null;
    ctx.OnPostRender = [];
    ctx.OnPostRender.push(function(){ 
    QStringResults= getQuString(); //here am unable to read the QStringResults value 
     _#-->  
    the below is my cstomhtml file
    am unable to  get the values :
                   <a href="http://srvrname:2013/sites/CMP/_layouts/15/BIFAddInputRef/bifpage1.aspx?bif1=_#= $htmlEncode(QStringResults) =#_"> Add Input Reference </a>
    <html xmlns:mso="urn:schemas-microsoft-com:office:office" xmlns:msdt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882"> 
    <head>
    <title>Item BIF</title>
    <!--[if gte mso 9]><xml>
    <mso:CustomDocumentProperties>
    <mso:TemplateHidden msdt:dt="string">0</mso:TemplateHidden>
    <mso:MasterPageDescription msdt:dt="string">Displays the default result item template.</mso:MasterPageDescription>
    <mso:ContentTypeId msdt:dt="string">0x0101002039C03B61C64EC4A04F5361F385106603</mso:ContentTypeId>
    <mso:TargetControlType msdt:dt="string">;#SearchResults;#</mso:TargetControlType>
    <mso:HtmlDesignAssociated msdt:dt="string">1</mso:HtmlDesignAssociated>
    <mso:ManagedPropertyMapping msdt:dt="string">'Title':'Title','Path':'Path','Description':'Description','EditorOWSUSER':'EditorOWSUSER','LastModifiedTime':'LastModifiedTime','CollapsingStatus':'CollapsingStatus','DocId':'DocId','HitHighlightedSummary':'HitHighlightedSummary','HitHighlightedProperties':'HitHighlightedProperties','FileExtension':'FileExtension','ViewsLifeTime':'ViewsLifeTime','ParentLink':'ParentLink','FileType':'FileType','IsContainer':'IsContainer','SecondaryFileExtension':'SecondaryFileExtension','DisplayAuthor':'DisplayAuthor','CMPBIFURL2':'CMPBIFURL2'</mso:ManagedPropertyMapping>
    <mso:_dlc_DocId msdt:dt="string">X3CVW7PXYF6P-3-222</mso:_dlc_DocId>
    <mso:_dlc_DocIdItemGuid msdt:dt="string">3ed12157-ea19-4591-b9cd-7a826aef35dc</mso:_dlc_DocIdItemGuid>
    <mso:_dlc_DocIdUrl msdt:dt="string">http://srvrname:2013/sites/CMP/_layouts/15/DocIdRedir.aspx?ID=X3CVW7PXYF6P-3-222, X3CVW7PXYF6P-3-222</mso:_dlc_DocIdUrl>
    </mso:CustomDocumentProperties>
    </xml><![endif]-->
    </head>
    <body>
        <script>
            $includeLanguageScript(this.url,"~sitecollection/_catalogs/masterpage/Display Templates/Search/BIFJScript.js");
        </script>
        <div id="Item_BIF2">
    <!--#_ 
            if(!$isNull(ctx.CurrentItem) && !$isNull(ctx.ClientControl)){
                var id = ctx.ClientControl.get_nextUniqueId();
                var itemId = id + Srch.U.Ids.item;
    var hoverId = id + Srch.U.Ids.hover;
    var hoverUrl = "~sitecollection/_catalogs/masterpage/Display Templates/Search/Item_Default_HoverPanel.js";
                $setResultItem(itemId, ctx.CurrentItem);
    if(ctx.CurrentItem.IsContainer){
    ctx.CurrentItem.csr_Icon = Srch.U.getFolderIconUrl();
    ctx.currentItem_ShowHoverPanelCallback = Srch.U.getShowHoverPanelCallback(itemId, hoverId, hoverUrl);
                ctx.currentItem_HideHoverPanelCallback = Srch.U.getHideHoverPanelCallback();
    _#-->
             <!--#_
               var QStringResults= null;
    ctx.OnPostRender = [];
    ctx.OnPostRender.push(function(){ 
    QStringResults= getQuString();
     _#-->  
            <div id="_#= $htmlEncode(QStringResults) =#_" name="bifItemqstring" 
                    data-displaytemplate="DefaultItem" class="ms-srch-item" 
                    >
                    <h5 style="color:ghostwhite;background-color:black">
                        <a href="_#= ctx.CurrentItem.Path =#_"> _#= ctx.CurrentItem.Path =#_</a>
                    </h5>
                </div>
                <div id="_#= $htmlEncode(itemId) =#_" name="bifItem" 
                    data-displaytemplate="DefaultItem" class="ms-srch-item" 
                    onmouseover="_#= ctx.currentItem_ShowHoverPanelCallback =#_" 
                    onmouseout="_#= ctx.currentItem_HideHoverPanelCallback =#_">
                    <h1 style="color:ghostwhite;background-color:black">
                        <a href="_#= ctx.CurrentItem.Path =#_"> _#= ctx.CurrentItem.Path =#_</a>
                    </h1>
                    <h4 style="color:ghostwhite;background-color:black">
                        <a href="_#= ctx.CurrentItem.Description =#_"> _#= ctx.CurrentItem.Description =#_</a>
                    </h4>
                    <h4 style="color:ghostwhite;background-color:black">
                        <a href="_#= ctx.CurrentItem.LastModifiedTime =#_"> _#= ctx.CurrentItem.LastModifiedTime =#_</a>
                    </h4>
                    <h3 style="color:floralwhite;background-color:green">
                        var mybifurl1= document.getElementById($htmlEncode(QStringResults));
                    <a href="http://srvrname:2013/sites/CMP/_layouts/15/BIFAddInputRef/bifpage1.aspx?bif1=_#= $htmlEncode(QStringResults) =#_"> Add Input Reference </a>
                    </h3>
                  </div>
            <div>
            </div>
                    <div id="_#= $htmlEncode(hoverId) =#_" class="ms-srch-hover-outerContainer"></div>
    <!--#_ 
    _#-->
        </div>
    </body>
    </html>
    when i run the page , i a getting the query string value as   undefined! though the custom javascript is getting called.

    i am able to get the  results  by implementing the below:
    <h4 style="background-color:black">
                        <a onclick="javascript:mycalltojs(_#=
    ctx.CurrentItem.Path=#_) > click here </a>
                    </h4>
    hope this helps  anyone

  • Content Search Web Part - display template Error

    Hi,
    I have an office 365 site, where in I have more than one Content Search Web Part and I have written custom display templates to be used in CSWP.
    Now, the issue is, whenever the page is browsed (intermittent in this case) and the page is edited to edit the CSWP (always in this case), the javascript files corresponding to the display templates are not loaded and because of which its throwing 'Sorry,
    something went wrong' error. 
    Thanks
    Senthil

    Hi Senthu,
    Any updates on this issue?
    Since there are articles describe how to customize template for content search web part, I'd recommend you refer to them and check/debug your script:
    http://blogs.technet.com/b/sharepoint_quick_reads/archive/2013/08/01/sharepoint-2013-customize-display-template-for-content-by-search-web-part-cswp-part-1.aspx
    http://blogs.technet.com/b/sharepoint_quick_reads/archive/2013/08/02/sharepoint-2013-customize-display-template-for-content-by-search-web-part-cswp-part-2.aspx
    If you suspect there is performance issue, you could test it on other browsers or machines.
    If the issue persists on reference in the script, please refer to the articles and try to find one which can meet your requirement.
    http://onlinecoder.blogspot.com/2013/10/localizing-cswp-display-templates-in.html
    Regards,
    Rebecca Tu
    TechNet Community Support

  • Sharepoint Online - Content Search, some Display Templates missing.

    I'm experimenting Content Search web parts in a number of Site Collections, but appear to be getting different Display Templates available.
    Can anyone explain what controls the availability of the templates please...
    Our Default root site collection.
    http://company.sharepoint.com
    Has Web part controls of
    List & Slideshow
    And Item Templates of
    Large Picture, Picture on left 3 lines, Recommended Items & Video
    All other site collections  http://company.sharepoint.com/sites/Dept1
    Has Web part controls of List
    & Slideshow
    PLUS List with Paging
    And Item Templates of
    Large Picture, Picture on left 3 lines, Recommended Items & Video
    PLUS Diagnostic, Picture on Top 3 Lines bottom, & Two Lines
    I've compared site and collection features and cannot see any features that would appear to control this...
    Any ideas.... Please!
    Cheers
    Russ

    I just had the same issue, I think it was something with broken upgrade code from 2013.
    Anyways, I solved it:
    Go to Master Page Gallery --> Display Templates --> Content Web Parts
    Delete all JavaScript Files in there except the Group_Content.js (!!!), they seem to have messed up metadata (Content Type Reference and Template Level)
    Open up PowerShell and issue this command:
    Get-SPFeature SearchTemplatesandResources | Enable-SPFeature -Url [URLtoBrokenSite] -Force
    This will re-upload the JavaScript files and all controls and templates finally are there again, hopefully ;)
    // Tried and true method for weather forecasting - random numbers. String weather = (new Random()).Next(2)==0?"rainy":"sunny";

  • Search Results Clear On Refinement with custom Display Template

    I am working with a custom search display template. I did minor presentation changes in the template. I am showing a checkbox against each search item and there is some logic behind it.
    For this I am using Item_Default Template.
    ctx.OnPostRender = [];
    ctx.OnPostRender.push(function(){
    $('input[name=checkbox]').change(function(){
    //My Logic
    With this is in place, on page load it shows initial results just fine and my checkbox logic also works fine.
    However, whenever user hits a refinement value the results clear out and no longer display. I know the results are there because when I do reload of the page refined results appears but again when you click on refinement value results disappear.
    With some digging on the forums I found that use "AddPostRenderCallback(ctx,function(){" instead of "ctx.OnPostRender.push", I tried this as well but it didn't help.
    Whenever I remove "ctx.OnPostRender.push(function(){" code from my template, refinement panel starts working properly again. So there has to be something related to this "ctx.OnPostRender.push". I cant just
    remove it because I have to write my JS logic as well for that this function is must.
    Please give me some pointers.
    Thanks
    Sarvesh
    Regards Sarvesh Shinde SharePoint Developer, India

    i am able to get the  results  by implementing the below:
    <h4 style="background-color:black">
                        <a onclick="javascript:mycalltojs(_#=
    ctx.CurrentItem.Path=#_) > click here </a>
                    </h4>
    hope this helps  anyone

  • Custom display template for search

    HI 
    I have Created a custom Item Template as shown below.I want to map this with my custom result type but it is not working
    <html xmlns:mso="urn:schemas-microsoft-com:office:office" xmlns:msdt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882">
    <head>
    <title>News Item</title>
    <!--[if gte mso 9]><xml>
    <mso:CustomDocumentProperties>
    <mso:TemplateHidden msdt:dt="string">0</mso:TemplateHidden>
    <mso:MasterPageDescription msdt:dt="string">$Resources:Microsoft.Office.Server.Search,DisplayTemplateDescription_SearchDefaultItem</mso:MasterPageDescription>
    <mso:ContentTypeId msdt:dt="string">0x0101002039C03B61C64EC4A04F5361F385106603</mso:ContentTypeId>
    <mso:TargetControlType msdt:dt="string">;#SearchResults;#</mso:TargetControlType>
    <mso:HtmlDesignAssociated msdt:dt="string">1</mso:HtmlDesignAssociated>
    <mso:ManagedPropertyMapping msdt:dt="string">'Title':'Title','Path':'Path','Description':'Description','EditorOWSUSER':'EditorOWSUSER','LastModifiedTime':'LastModifiedTime','CollapsingStatus':'CollapsingStatus','DocId':'DocId','HitHighlightedSummary':'HitHighlightedSummary','HitHighlightedProperties':'HitHighlightedProperties','FileExtension':'FileExtension','ViewsLifeTime':'ViewsLifeTime','ParentLink':'ParentLink','FileType':'FileType','IsContainer':'IsContainer','SecondaryFileExtension':'SecondaryFileExtension','SEDWMPNewsPublishDate':'SEDWMPNewsPublishDate','DisplayAuthor':'DisplayAuthor1','SiteTitle':'SiteTitle'</mso:ManagedPropertyMapping>
    <mso:HtmlDesignConversionSucceeded msdt:dt="string">True</mso:HtmlDesignConversionSucceeded>
    <mso:CrawlerXSLFile msdt:dt="string"></mso:CrawlerXSLFile>
    <mso:HtmlDesignPreviewUrl msdt:dt="string"></mso:HtmlDesignPreviewUrl>
    </mso:CustomDocumentProperties>
    </xml><![endif]-->
    </head>
    <body>
    <div id="StoraEnso_Item_Default">
    <!--#_
    if(!$isNull(ctx.CurrentItem) && !$isNull(ctx.ClientControl)){
    var id = ctx.ClientControl.get_nextUniqueId();
    var itemId = id + Srch.U.Ids.item;
    var hoverId = id + Srch.U.Ids.hover;
    var hoverUrl = "~sitecollection/_catalogs/masterpage/Display Templates/Search/Item_Default_HoverPanel.js";
    $setResultItem(itemId, ctx.CurrentItem);
    if(ctx.CurrentItem.IsContainer){
    ctx.CurrentItem.csr_Icon = Srch.U.getFolderIconUrl();
    ctx.currentItem_ShowHoverPanelCallback = Srch.U.getShowHoverPanelCallback(itemId, hoverId, hoverUrl);
    ctx.currentItem_HideHoverPanelCallback = Srch.U.getHideHoverPanelCallback();
    _#-->
    <div id="_#= $htmlEncode(itemId) =#_" name="SEItem" data-displaytemplate="StoraEnsoDefaultItem" class="ms-srch-item" onmouseover="_#= ctx.currentItem_ShowHoverPanelCallback =#_" onmouseout="_#= ctx.currentItem_HideHoverPanelCallback =#_">
    <h2 class="heading"><a href="_#= ctx.CurrentItem.Path =#_">_#= ctx.CurrentItem.Title =#_</a></h2>
    <div id="_#= $htmlEncode(hoverId) =#_" class="ms-srch-hover-outerContainer"></div>
    <p>_#= Srch.U.processHHXML(ctx.CurrentItem.HitHighlightedSummary) =#_</p>
    <div class="footer">
    <dl class="desc">
    <dt>SiteTitle</dt> _#= ctx.CurrentItem.SEDWMPNewsPublishDate =#_
    <dd><a class="status" href="#">_#= ctx.CurrentItem.SiteTitle =#_</a></dd>
    <dt>Author</dt>
    <dd><a class="status" href="#">_#= ctx.CurrentItem.DisplayAuthor =#_</a></dd>
    </dl>
    </div>
    </div>
    <!--#_
    _#-->
    </div>
    </body>
    </html>
    If you see in "managedPropertyMapping" I have added a new property "SEDWMPNewsPublishDate" and when I use in my html I am not getting the value.
    I checked with fiddler and I found that This property is not getting mapped. Json object does return this property.However  this property has value. I have tested with content search webpart nad my code also.it returns value.
    Can anyone let me know is there any issue in the above rendering template code 
    On update to this, I was using resultscript webpart on the page to display data and I have created custom result type to modify the display.What I found that when I add the custom properties which I need, on result script webpart  using as
    follows 
     scriptWebPart.SelectedPropertiesJson = "[\"SEDWMPNewsPublishDate\",\"SEDWMPIntroduction\"]"
    and save the changes then I start getting the value of my custom properties.
    I don't know how the result type works in accordance with display templates and when does it gets applied on the search data.If anyone is aware please let me know.
    If I can't use the display templates with custom properties then what is the use of ManagedPropertyMapping on display templates.Can anyone please make me understand?

    You need to update the js file also.You can upload the js file also.In js file you have a column "ManagedPropertyMapping" this denotes which managed property should come for item in search.
    For uploading the js file you can use as follows under module
     <File Path="ModSearchDisplayTemplates\x.js" Url="x.js" Type="GhostableInLibrary">
          <Property Name="Title" Value="xjs" />
          <Property Name="MasterPageDescription" Value="$Resources:Microsoft.Office.Server.Search,DisplayTemplateDescription_SearchDefaultItem" />
          <Property Name="ContentType" Value="$Resources:TemplateContentType_Code_Name" />
          <Property Name="DisplayTemplateLevel" Value="Item" />
          <Property Name="TemplateHidden" Value="0" />
          <Property Name="TargetControlType" Value=";#SearchResults;#" />
          <Property Name="HtmlDesignLockedFile" Value="TRUE" />
          <Property Name="ManagedPropertyMapping" Value="'Title':'Title','Path':'Path','Description':'Description','EditorOWSUSER':'EditorOWSUSER','LastModifiedTime':'LastModifiedTime','CollapsingStatus':'CollapsingStatus','DocId':'DocId','FileExtension':'FileExtension','ParentLink':'ParentLink','FileType':'FileType','IsContainer':'IsContainer','SEDWMPNewsPublishDate00':'SEDWMPNewsPublishDate00','SEDWMPIntroduction':'SEDWMPIntroduction','SEDWMPNewsIsSticky':'SEDWMPNewsIsSticky','SEDWMPNewsPostThreadId':'SEDWMPNewsPostThreadId'"/>
        </File>

  • How to display the Author's Photo in a Display Template

    I am creating a custom display template that will show the date and contents of a blog post on the right, with a thumbnail of the author on the left. I cannot figure out how to retrieve the URL for the users photo from the display template.
    My first thought was that maybe there was a Managed Property I could choose in the property mappings. The Author Property will give me the Last Name, FirstName of the author. There is also a AuthorOWSUSER, which I thought might be an object with properties
    I could reference, like .FirstName, .Picture, etc. But this doesn't appear to work.
    My guess is that I have to do some scripting in the display template itself, but I just don't know where to find any references on this.

    Hi,
    I have done this in a Project before mounth. Create a Blog Post Site an attach with Visual Studio. There is a lib
    sp.ui.blogs.debug.js.
    When you load a Blog with comments, you can put a breakpoint and step Through.
    There is a Function, that renders the Photo from the Author Field.
    Hier is my code:
    function renderAuthor(ctx, $p1) {
    var $v_0 = SP.ScriptHelpers.getFieldFromSchema(ctx.ListSchema, 'Author');
    if (!SP.ScriptHelpers.isNullOrUndefined($v_0)) {
    var $v_1 = $v_0.WithPictureDetail;
    var $v_2 = $v_0.PictureOnly;
    $v_0.DefaultRender = 0;
    $v_0.WithPictureDetail = 0;
    $v_0.PictureOnly = 1;
    $v_0.PictureSize = 'Size_48px';
    $p1.write(spMgr.RenderFieldByName(ctx, 'Author', ctx.CurrentItem, ctx.ListSchema));
    $v_0.WithPictureDetail = $v_1;
    $v_0.PictureOnly = $v_2;
    It is very important that your Content Type Field has the Attribute ShowField="NameWithPictureAndDetails"
    Then you dont need to query UserProfile for Pictures, the info will be in the Fiedl.
    Chears
    Martin

  • Managed properties in display templates

    Hi
    I'm trying to include some custom managed properties (GlossaryProductString) into my custom display template but the ct.CurrentItem.GlossaryProductString is always undefined.
    What I did:
     Create managed property and mark it as retrievable
    Full crawl (I'm able to find results when using GlossaryProductString:"some content" as query)
    Downloaded the item_default.html and renamed it
    Added GlossaryProdcutString to the ManagedPropertyMapping properties ('GlossaryProductString':'GlossaryProductString')
    Add the content to the template:
    <p>Product: <span style="font-weight: 200">_#= ctx.CurrentItem.GlossaryProductString =#_</span></p>
    all other stuff that is needed that the display template is used
    The display template shows up for the results but the GlossaryProductString is always empty (undefined in JS object)
    Any ideas?
    Thanks for help.

    Hi
    The REST call returns the GlossaryProductString. Here an excerpt of the result:
    - <d:element m:type="SP.SimpleDataRow">
    - <d:Cells>
    - <d:element m:type="SP.KeyValue">
    <d:Key>Rank</d:Key>
    <d:Value>11.5733613967896</d:Value>
    <d:ValueType>Edm.Double</d:ValueType>
    </d:element>
    - <d:element m:type="SP.KeyValue">
    <d:Key>DocId</d:Key>
    <d:Value>725</d:Value>
    <d:ValueType>Edm.Int64</d:ValueType>
    </d:element>
    - <d:element m:type="SP.KeyValue">
    <d:Key>Title</d:Key>
    <d:Value>Argument</d:Value>
    <d:ValueType>Edm.String</d:ValueType>
    </d:element>
    - <d:element m:type="SP.KeyValue">
    <d:Key>Path</d:Key>
    <d:Value>https://sst-s13.ioztest.ch/glossary/Lists/Definitions/DispForm.aspx?ID=8</d:Value>
    <d:ValueType>Edm.String</d:ValueType>
    </d:element>
    - <d:element m:type="SP.KeyValue">
    <d:Key>GlossaryProductString</d:Key>
    <d:Value>Excel</d:Value>
    <d:ValueType>Edm.String</d:ValueType>
    </d:element>
    - <d:element m:type="SP.KeyValue">
    <d:Key>OriginalPath</d:Key>
    <d:Value>https://sst-s13.ioztest.ch/glossary/Lists/Definitions/DispForm.aspx?ID=8</d:Value>
    <d:ValueType>Edm.String</d:ValueType>

  • Sharepoint 2013 custom search results grouping display template

    Hi,
    I am trying to implement custom grouping for search result items. I would like to group them by a managed property, but without using result blocks (query rules). The idea is to sort the results by the property and then compare the current item (ctx.CurrentItem)
    with the previous item using ctx.CurrentItem.ParentTableReference. If a new property value is detected we insert a new 'group header' (just some simple html). The problem is the ParentTableReference is undefined. Shouldn't there be such a property in current
    item object?
    I'm implementing this in a custom search result item display template...
    Thanks in advance.

    Hi,
    According to your post, my understanding is that you want to customize search result items display template.
    I suggest you get enumerate all properties of JavaScript context object and debug you code to watch the
    ctx.CurrentItem object.
    The following articles for your reference:
    Debugging Display Templates in SharePoint 2013 Search
    http://powersearching.wordpress.com/2013/01/25/debugging-display-temlates-in-sharepoint-2013-search/
    Enumerate all properties of JavaScript context object in display templates in SharePoint 2013
    http://sadomovalex.blogspot.co.uk/2013/06/enumerate-all-properties-of-javascript.html
    How to Define a Custom Group Display Template (GroupTemplateId) for the Search Results WebPart via JavaScript
    http://www.eliostruyf.com/how-to-define-a-custom-group-display-template-for-the-search-results-webpart-via-javascript/
    Creating customized search results in SharePoint 2013
    http://www.abelsolutions.com/totm/creating-customized-search-results-in-sharepoint-2013/
    Best Regards
    Dennis Guo
    TechNet Community Support

Maybe you are looking for

  • Change of time stamp on RAW thumbnails

    I have PSE 9.0. I shoot in RAW on a Canon 550D and a Canon G10. When I open a RAW file in editor, whether or not I edit that file, it changes the time stamp on the thumbnail by 1 hour. If I open it twice it changes the time by two hours, eg from 1.10

  • SAP BI 4.0 SP2 on Linux and Postgresql Datasource via JDBC drivers

    Hi, I installed SAP BI Platform 4.0 SP2 on Redhat 5.2 and i try to access as a universe datasource a postgresql database (v8.4). But i don't know how to configure the postgresql JDBC driver on linux server. does anyone have a step by step procedure t

  • Force only digital or only analogue video output?

    is there any script or terminal command to force the mac mini to only output analogue video signal or only digital video signal? I have a dvi Y splitter that splits the DVI out to VGA and DVI. When using windows XP under bootcamp I can choose which s

  • Broken iPhone 4 screen help

    I was on the way how from the gym and dropped my iPhone obviously the screen has now shattered and the touch screen is slow. I do not have insurance, how much is it to get it replaced??? From apple?? I hate that as soon as it falls the screen shatter

  • Scattered text reading pdf on Mac

    I've just opened a pdf bank statement online which to my horror displayed as scattered letters all over the page.  I'm using Mac OS X 10.6.8. I'm not sure what to do - I tried downloading Adobe Reader again but didn't have any luck, I think I messed