Ensure User issue in item template of content search webpart
I have used a custom item and control template for content search webpart.My issue is that on each item,i am showing a popup using callout.js which shows the users.The managed properties give me the email addresses,But i want to display usernames instead of email addresses.I need to use ensureuser which is an async call.By the time the async call goes to success, the execution goes to the next item and the life of the previous items code is gone.The Execution does go in success but doesnt have access to any variables as their life is gone.please help
September 1st, 2015 4:37am

Hi Suraj,

Can you provide your complete code for a further research?

As a common practice, I suggest you debug your code in browser using IE Developer Tools, it will give you more details about the execution of your code which would be helpful to you to find the root cause of this issue.

Debug JavaScript using IE developer tool

https://msdn.microsoft.com/en-us/library/ie/bg182326(v=vs.85)

Whats more, if you want to display the user name in a search result, please check that if there is a managed property for saving user name. If there is such managed property, you can display it by simple customizing the display template without send requests to get user names from server.

About how to display specific managed properties by customizing display template for your reference:

http://blogs.technet.com/b/tothesharepoint/archive/2013/09/11/how-to-display-values-from-custom-managed-properties-in-search-results-option-1.aspx

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

Thanks                 

Patrick Liang

Free Windows Admin Tool Kit Click here and download it now
September 2nd, 2015 2:35am

Hi,

If you want to customize a item and control template for the content search web part, I suggest you refer to the OOB template.

http://blog.mmasood.com/2014/05/customising-sharepoint-2013-people.html

To display the username, please try to use the "UserName" property.

https://technet.microsoft.com/en-us/library/jj219630(v=office.15).aspx

Or please provide some code or more information for further research.

Best Regards,

Dennis Guo

September 2nd, 2015 2:51am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics