CSWP Display Template Item - Include Like / Rating SharePoint control

I'm working with the Content Search Web Part to bring details from Announcements lists up to the home page.  Each of these lists has the Like / Rating Social elements enabled and I would like to surface this on the Item Display Template but can't find
out how.
Is there a SharePoint control or JavaScript that I can use to surface this content?
Thanks

Ok, after searching I've found a solution for this.  It will be a 2 stage solution, the first simply displaying the rating or number of likes, the second actually updating them.
So, stage 1:
1.  You need to login to your Central Administration site and go to your Search Service Application.  Once there, under "Queries and Results", click "Search Schema".  You can apply a filter to help find the relevant managed property, so filter
on "Like" or "Rating".  In this example I wanted to use the number of likes, so after filtering on "Like" I clicked to edit the "LikesCount" managed property.  From the edit page, located the "Main characteristics" heading and ensure that the "Searchable"
checkbox is ticked.  Click "Ok" and run a "Full Crawl" on your content source.
2.  Once this has been done, locate the Display Item Content Template that will be used for the Content Search Web Part.  At the top of this file you will find an <mso:ManagedPropertyMapping /> tag.  In this you want to register the
LikesCount managed property from earlier.  This can be done by copying something similar to below:
&#39;Likes Count&#39;{Likes Count}:&#39;LikesCount&#39;
Further down the template, within the <div> where you can define content you need to setup a variable that reads the LikesCount value.  I also had some trouble reading this value when there were no Likes on an item, == null and isNaN() didn't
seem to work so I added an if statement to check for 0 items.
var likesCount = $getItemValue(ctx, "Likes Count");
if (!(likesCount > 0)) {
    likesCount = 0;
Finally, you can surface this variable into your content by simply using the normal notation.  i.e.
_#= likesCount =#_
I hope this has been of use to some people.  I will be posting an update once I've figured out if it's possible to like the source list item from the CSWP.

Similar Messages

  • Want to display menu item horizontally in hover menu control?

    hi,
    I have to display 3 buttons as menu items in a hover menu horizontally. As the hover menu control only show the menu items in vertical form, but for a specific task, i have to place 3 buttons side by side in hover menu. if anyone have tried this please help me.
    Thanks in advance
    Deepak

    Hi,
    I have a suggestion:
    Design your page into tables and rows.
    Divide each row into columns.Example:
    <table>
    <tr>
    <td>
    <hbj:hoverMenu
      id="hover1"
      standAlone="true">
    <hbj:hoverMenuItem
        id="1"
        text="Size"
        />
    </hbj:hoverMenu>
    </td>
    <td>
    <hbj:hoverMenu
      id="hover2"
      standAlone="true">
    <hbj:hoverMenuItem
        id="1"
        text="Size"
        />
    </hbj:hoverMenu>
    </td>
    </tr>
    </table>
    If you want to align the sub menu accordingly,you can again divide each row of the table into a subtable with rows and columns.
    Hope this helps.
    Regards,
    Harish
    (Please award points if this answer is usefull)

  • Group display templates

    Hi all
    I am implementing a search-driven carousel in SharePoint Online 2013 Preview like this one: http://www.blendmaster.net/blog/2012/11/search-driven-twitter-bootstrap-carousel-in-sharepoint-2013/.
    Unlike that one, I am implementing it using the Search Results web part, not the Content Search web part, because the latter one isn't available in SharePoint Online 2013 Preview.
    It is working, however, as well as customising the control and item display templates, I am wanting to customise the group display template; however, I can't find how to "register" the group display template.
    Does anyone know how to associate a group display template with a control display template or, alternatively, how to associate the group display template with the Search Results web part?
    Regards,
    Chris

    Are group templates even available in the CSWP Display templates? It seems I saw on this blog a reference of OOTB templates and only saw a group template for the Search Results Web Part. I have read other posts where you could actually inject a group template
    into the CSWP. Even with that I do not see any examples of how to build the query rule and result block so that you can group results using the CSWP.
    Am I barking up the wrong tree with trying to roll-up content using the CSWP? It seems that everyone wants to group their results like they did using the CQWP but this seems to be very difficult or not well documented. I, for one, have been struggling with
    this for weeks without any success. This should not be so difficult.
    If we don't use the CSWP for content roll-up then what are my other options for cross site-collection roll-ups?

  • 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

  • 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

  • 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

  • Programaticlly change reference of display template for a CSWP

    I have created a custom display template for one of my CSWP.
    Now, How can I change the CSWP property - Item and Control Template, programmatically.
    - GEM

    Hi,
    According to your post, my understanding is that you want to change the content search web part property.
    To change the web part property, we can override the GetToolParts method and return a CustomPropertyToolPart object along with the base toolparts.
    there is an article about this topic, you can refer to it.
    http://www.lestersconyers.com/extending-search-web-parts/
    More reference:
    http://blogs.msdn.com/b/davidrei/archive/2012/12/27/sharepoint-2013-set-content-search-web-part-querytext-attribute-programmatically.aspx
    Thanks & Regards,
    Jason
    Jason Guo
    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";

  • Display Template limitation of 50 items

    Hi,
    is there a way to get over the Display Template limitation of 50 items?
    keren tsur

    I found a workaround to this limitation and have blogged about it here: 
    http://www.scottewing.net/Blog/Post/2/Getting-Around-the-Content-Search-Web-Part%27s-50-Results-Limit
    It requires writing server-side code using reflection and deploying a farm solution, so if you don't have that option then you may be stuck.  There's also a client-side solution here but it doesn't work for anonymous access: 
    http://sharepoint-community.net/forum/topics/how-to-override-content-by-search-web-part-s-limit-of-50-results
    In most cases I'd agree that you shouldn't show more than 50 results on a page.  However, I believe there are almost always exceptions to every rule.  In my case, I needed to go over this limit because we were porting a WordPress site
    over that had a page that needed this, and we needed it to behave the same way.
     - Scott

  • 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?

  • 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());

  • Customizng SharePoint 2013 Display Template

    hi i am trying to customize Item_Picture3Lines.html and result not appear Note i am using content search web part and change query to specific content type it returns result but my display template does not render data i am trying to add Line 4 but no
    result appear My Code Sample :-
    <html xmlns:mso="urn:schemas-microsoft-com:office:office" xmlns:msdt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882">
    <head>
    <title>Display Template</title>
    <!--[if gte mso 9]><xml>
    <mso:CustomDocumentProperties>
    <mso:TemplateHidden msdt:dt="string">0</mso:TemplateHidden>
    <mso:ManagedPropertyMapping msdt:dt="string">
    'Picture URL'{Picture URL}:'PublishingImage;PictureURL;PictureThumbnailURL',
    'Link URL'{Link URL}:'Path',
    'Line 1'{Line 1}:'Title',
    'Line 2'{Line 2}:'Description',
    'Line 3'{Line 3}:'',
    'Line 4'{Line 4}:'',
    'SecondaryFileExtension',
    'ContentTypeId'
    </mso:ManagedPropertyMapping>
    <mso:MasterPageDescription msdt:dt="string">This Item Display Template will show a 100x100 picture of the item on the left. The title and the default item description will display to the right of the picture with an additional line that is available for a custom managed property.</mso:MasterPageDescription>
    <mso:ContentTypeId msdt:dt="string">0x0101002039C03B61C64EC4A04F5361F385106603</mso:ContentTypeId>
    <mso:TargetControlType msdt:dt="string">;#Content Web Parts;#</mso:TargetControlType>
    <mso:HtmlDesignAssociated msdt:dt="string">1</mso:HtmlDesignAssociated>
    <mso:HtmlDesignStatusAndPreview msdt:dt="string">http://c1-dev02/sites/ContentSearchWebPart/_catalogs/masterpage/Display Templates/Content Web Parts/Item_Picture3Lines - Copy.html, Conversion successful.</mso:HtmlDesignStatusAndPreview>
    <mso:HtmlDesignConversionSucceeded msdt:dt="string">True</mso:HtmlDesignConversionSucceeded>
    </mso:CustomDocumentProperties>
    </xml><![endif]-->
    </head>
    <body>
    <!--
    Warning: Do not try to add HTML to this section. Only the contents of the first <div>
    inside the <body> tag will be used while executing Display Template code. Any HTML that
    you add to this section will NOT become part of your Display Template.
    -->
    <script>
    $includeLanguageScript(this.url, "~sitecollection/_catalogs/masterpage/Display Templates/Language Files/{Locale}/CustomStrings.js");
    </script>
    <!--
    Use the div below to author your Display Template. Here are some things to keep in mind:
    * Surround any JavaScript logic as shown below using a "pound underscore" (#_ ... _#) token
    inside a comment.
    * Use the values assigned to your variables using an "underscore pound equals"
    (_#= ... =#_) token.
    -->
    <div id="Item_Picture3Lines - Copy">
    <!--#_
    var encodedId = $htmlEncode(ctx.ClientControl.get_nextUniqueId() + "_picture3Lines_");
    var linkURL = $getItemValue(ctx, "Link URL");
    linkURL.overrideValueRenderer($urlHtmlEncode);
    var line1 = $getItemValue(ctx, "Line 1");
    var line2 = $getItemValue(ctx, "Line 2");
    var line3 = $getItemValue(ctx, "Line 3");
    var line4 = $getItemValue(ctx, "Line 4");
    var pictureURL = $getItemValue(ctx, "Picture URL");
    var pictureId = encodedId + "picture";
    var pictureMarkup = Srch.ContentBySearch.getPictureMarkup(pictureURL, 100, 100, ctx.CurrentItem, "cbs-picture3LinesImg", line1, pictureId);
    line1.overrideValueRenderer($contentLineText);
    line2.overrideValueRenderer($contentLineText);
    line3.overrideValueRenderer($contentLineText);
    var containerId = encodedId + "container";
    var pictureLinkId = encodedId + "pictureLink";
    var pictureContainerId = encodedId + "pictureContainer";
    var dataContainerId = encodedId + "dataContainer";
    var line1LinkId = encodedId + "line1Link";
    var line1Id = encodedId + "line1";
    var line2Id = encodedId + "line2";
    var line3Id = encodedId + "line3";
    var line4Id = encodedId + "line4";
    var dataDisplayTemplateTitle = "ItemPicture3Lines";
    _#-->
    <div class="cbs-picture3LinesContainer" id="_#= containerId =#_" data-displaytemplate="_#= $htmlEncode(dataDisplayTemplateTitle) =#_">
    <div class="cbs-picture3LinesImageContainer" id="_#= pictureContainerId =#_">
    <!--#_
    if(!linkURL.isEmpty)
    _#-->
    <a class="cbs-pictureImgLink" href="_#= linkURL =#_" title="_#= $htmlEncode(line1.defaultValueRenderer(line1)) =#_" id="_#= pictureLinkId =#_"
    >
    <!--#_
    _#-->
    _#= pictureMarkup =#_
    <!--#_
    if(!linkURL.isEmpty)
    _#-->
    </a>
    <!--#_
    _#-->
    </div>
    <div class="cbs-picture3LinesDataContainer" id="_#= dataContainerId =#_">
    <a class="cbs-picture3LinesLine1Link" href="_#= linkURL =#_" title="_#= $htmlEncode(line1.defaultValueRenderer(line1)) =#_" id="_#= line1LinkId =#_"
    >
    <h2 class="cbs-picture3LinesLine1 ms-accentText2 ms-noWrap" id="_#= line1Id =#_"> _#= line1 =#_</h2>
    </a>
    <!--#_
    if(!line2.isEmpty)
    _#-->
    <div class="cbs-picture3LinesLine2 ms-noWrap" title="_#= $htmlEncode(line2.defaultValueRenderer(line2)) =#_" id="_#= line2Id =#_" > _#= line2 =#_</div>
    <!--#_
    if(!line3.isEmpty)
    _#-->
    <div class="cbs-pictureLine3 ms-textSmall ms-noWrap" id="_#= line3Id =#_" title="_#= $htmlEncode(line3.defaultValueRenderer(line3)) =#_">_#= line3 =#_</div>
    <!--#_
    if(!line4.isEmpty)
    _#-->
    <div class="cbs-pictureLine3 ms-textSmall ms-noWrap" id="_#= line4Id =#_" title="_#= $htmlEncode(line4.defaultValueRenderer(line4)) =#_">_#= line4 =#_</div>
    <!--#_
    _#-->
    </div>
    </div>
    </div>
    </body>
    </html>

    Was looking for something else and stumbled across this... I'm sure you've sorted this out by now, but the problem, i think is that you're not specifying a data source (list/site column) for the Line 4 data field...or line 3 for that matter... See lines
    14 and 15 in your code sample. There should be a field reference between the ' '.

  • "SharePoint Designer cannot display the item" error when edit workflow

    Hi
    I create workflow for sharepoint list in version 2007. Then upgrade sharepoint form version 2007 to 2010. Now when I want to edit this workflow, get this error:
    “SharePoint Designer cannot display the item.
    What you can try:
    Click the Refresh button or press F5 to refresh the content from your site.
    Go back to the previous page
    Most likely causes:
    The file has been deleted from the site.
    The site is encountering problems.”
    What is the problem?
    Thanks.

    Hi,
    Have you used custom activity in your workflow? We may come across this issue when we use custom activity. A workaournd is to modify the Workflows XOML file, and remove custom activity reference from it. And restart your SharePoint designer. See below blog.
    http://saiabhilash.blogspot.com/2011/11/sharepoint-designer-cannot-display-item.html
    Or a quick workaround is recreate the workflow in SharePoint Designer 2010.
    Thanks & Regards,
    Emir
    Emir Liu
    TechNet Community Support

  • Custom display template - how to add anothe display template for refimement item?

    Custom display template - how to add anothe display template for refimement item?
    I add a new filter_default_custom.html file and want to create new refinement item display template to point to it
    keren tsur

    Not 100% if I understood the question, but if you uploaded your template to the Master Gallery and the corresponding .js file has been created, you can open the refinement config panel and specify the result type you want to map to your custom template.
    http://www.eliostruyf.com/part-1-create-first-search-refiner-control-template/
    Kind Regards
    Bjoern
    http://www.sharepointviking.com
    Twitter: Follow @bjoern_rapp

  • 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

Maybe you are looking for

  • Multiple condtions in choose statement

    Hi from a new BIP user! I have created an RTF where I need to output a paragraph of text based multiple conditions which are <RESORT>, if the <DATE> falls between a defined date range and if <TA> is null or not. I'm familiar with the simple choose wh

  • Adobe forms with file attachments

    Hello, I want to use file attachments in my offline adobe forms. I have found some articles about how to do that but it was all related to webdynpro which i'm not using for this scenario. Does anyone know how to do that in plain ABAP? Many thanks in

  • Outlook 2013 "Upgrade In Progress"

    I recently got Office 2013 and since I have it, my outlook has been displaying "upgrade in progress" because of which I can't log in or add an account!  I have done the whole "repair" for it twice and it's still displaying the same message. This is r

  • Moving an existing site?

    I have a feeling I know the answer to this but here goes: I have a web site managed elsewhere. Can I move it to .Mac? Or would I have to redo it using Iweb? Paul

  • SAP XI BPM Performance and statistics

    Hello all, I am currently working on an integration using the BPM process within XI.  During our initial testing, we noticed that, when it comes to the BPM process, XI takes too long to process a message.  The actual size of the payload is really sma