0

I have a question, When I include a custom managed property which I created mapped to user phone(people:phone) and added it to the people hover display template, I tried both var has_phone = !$isEmptyString($getItemValue(ctx, "WorkphoneCustom")); var has_phone = !$isEmptyString(ctx.CurrentItem.WorkPhone);

I was able to get the managed property values in refiners, but the display template is rendering as null. Any suggestions?

When I debugged, I saw that ctx.current item is not loading with the phonenumber in its properties. Do I need to do any additional steps for loading managedproperty(coming from user profile crawled property) into the current item? Any powershell?

2 Answers 2

0

So I kept trying to add the managed property to the item_personhoverpanel_copy.html. And it kept failing or showing that the ctx.currentitem doesnot have that value. But when I added the managed property to the item_person_copy.html, it has started coming up with value. I guess to add a managed property to hoverpanel display template it needs to be added to the item display template first. However I have the Work phone property now displaying on the display template. Also I was creating the result type copy at site level. Once I created a copy of the result type at site collection level, the property sync message started displaying when editing a display template.

if(has_phone == true) { var encodedVal = Srch.U.getTrimmedProcessedHHXMLString(Srch.U.getMultipleHHXMLNodeValues(hhProps, "Workphone", 5, delimiter), 145); if (Srch.U.e(encodedVal)) { encodedVal = $htmlEncode(Srch.U.getTrimmedString(Srch.U.getUnEncodedMultiValuedResults(ctx.CurrentItem.Workphone, 5, delimiter), 145)) } if (!Srch.U.e(encodedVal)) { infoAvailable = true; if(isExpResult == false) { _#-->
<li id="Workphone"> <div class="ms-srch-hover-subTitle"><h3 class="ms-soften">_#= $htmlEncode(Srch.Res.hp_PeopleItem_Workphone) =#_</h3></div> <div class="ms-srch-hover-text" id="_#= $htmlEncode(id + HP.ids.peopleWorkphone) =#_">Workphone : _#= encodedVal =#_ </div> </li> <!--#_ } _#--> <!--#_ } _#--> <!--#_
}

'Workphone':'Workphone'

0

I had the same issue and it was driving me crazy. The solution is quite simple but not so obvious, just make sure you check-in your new design template after you made your changes. As soon as you've done that, it's all good.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.