0

We have a BCS-model which gets data from a database outside of SharePoint. We make data from the BCS searchable by creating managed properties and then mapping them to the auto generated crawled properties from the BCS model.

I am developing a custom display template where I want to show that data from BCS. I can show some of the managed properties by accessing "ctx.CurrentItem", but not all of them. I.e I have a managed property called "CaseDate" which is not available on "ctx.CurrentItem". I can retrieve "CaseDate" by using rest API, but cannot find a way to access/show it in my display template.

Is there a way I can get a spesific managed property in my display template? How can I get the "CaseDate" in my display template ?

Edit: There is no error in crawl, and I have also tried "CaseDate" as managed property in ManagedProertyMapping in the display template.

3 Answers 3

0

Are you sure that you have included that managed property in the listing at the top of the item template? What does the Sharepoint search query tool show?

1
  • Yes. I am 100% sure of that. The Search Query tool show the value of "CaseDate" and all other fields I can not see value of.
    – Ilyas
    Commented Jun 14, 2018 at 16:53
0

After you created the Result Type Rule for your Display Template, did you go back to the Result Type Rule page? Sometimes there will be a yellow message saying your properties need to be updated. Click the affirmative action (the message should turn green) and try again.

4
  • I did not create any result type rule for the display template. Is that required ?
    – Ilyas
    Commented Jun 18, 2018 at 5:41
  • No, not required, but may help identifying the issue. You can delete it later. How are you showing your DT? Are you forcing it in the Results web part? Commented Jun 19, 2018 at 19:00
  • I was using result type without knowing it. I edited the standard search results web part. I found out that I had to map the properties in Item_Defaul.html, and not just in the hover panel as I was doint.
    – Ilyas
    Commented Jun 25, 2018 at 11:43
  • Right, if you want them in the HP you need them in the calling Display Template as well. Got it working? Commented Jun 25, 2018 at 15:35
0

I was editing standard search results web part. The reason why my mapped properties where not showing was because I only added the mapped property in the display template that shows the hover panel (Item_Commonhoverpanel_Body). I had to add the managed properties in the Item_Default also, or else it would not show them in the hover panel.

Of course I created my own display templates, and did not destroy the ones that ship with SharePoint.

This link helped me a lot:

When adding custom properties to a hover panel, you have to add them to the item display template

https://blogs.technet.microsoft.com/tothesharepoint/2013/09/12/how-to-display-values-from-custom-managed-properties-in-the-hover-panel-in-sharepoint-server-2013/

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.