Blogger

  • This email address is being protected from spambots. You need JavaScript enabled to view it.

    Recent items

Login

Tuesday, 25 November 2014 08:10

Display a custom Managed Property inside the Item_CommonItem_Body.html Display Template

Written by
Rate this item
(0 votes)

Hi everybody,

today I'm encourring in a strange problem: I need to display a value of a custom Managed Property inside the "Item_CommonItem_Body.html" Display Template, near the date visualization.

Here a little image regarding the result that I need (inside the red box there is the value of my custom Managed Property).

To add this value, you need to manipulate the "Item_CommonItem_Body.html" Display Template. How we know, to view the custom managed property, we need to declare it on top of the page and after we need to update the respective result type. So I go inside the result type page and I'm not able to see a result type that follow the "Item_CommonItem_Body.html" Display Template.

I've created a new result type that link to the Common Item Body, but when I reload the page, all items displayed are corrupted, the html il broken. Infact, all items had the id with undefined value and all not works fine.

At that time, the question was: how I can use it?

The solution is: you need to add the custom Managed Metadata definition inside the "Item_WebPage.html" Display template. After that, when you return inside the result type page, you need to copy the current one that contains the "Item_WebPage.html" display template. The system propones to update it.

Now the system is able to manage that values. So, now you can add the code to display the value inside the "Item_CommonItem_Body.html" Display template.

At the end of the history, to manage a custom Managed property inside the "Item_CommonItem_Body.html" display template, you need:

  1. Define the Managed Metadata property inside the "Item_WebPage.html" display template
  2. Create and update a result type based on "Item_WebPage.html"
  3. Use you custom managed metadata property inside the "Item_CommonItem_Body.html"

Note: if you don't want problems with a wrong displaying of the results, you mustn't never create a result type that use the "Item_CommonItem_Body.html".

Read 6107 times Last modified on Friday, 28 November 2014 07:59

Leave a comment

Make sure you enter all the required information, indicated by an asterisk (*). HTML code is not allowed.