0

We are using O365/Sharepoint Online 2013 (+ Sharepoint Designer 2013).

We are using people search center as our intranet "Phone book" and it's working really well and I managed to customize the search hover panel (Item_Person_HoverPanel.html) so that some of the "extra information" fields are showing in the hover panel such as Past Projects and Schools and Skills.

What we would still like to add is Past Jobs so users could list their past employers/jobs and it would show in the hover panel.

  • I created a new property in Sharepoint Admin Center -> User Profiles -> User properties settings

  • I used the exact same settings for it as the default Past Projects -property has. Only difference being the property name as Past Projects is named SPS-PastProjects and I tried SPS-PastJobs but it gave me an error about the "-" so I just named the new property as "PastJobs".

  • After creating the property, I moved it up to the "Information" category so it would show respectively in the information -tab when a user is editing his/her profile.

Ok now users can see the Past Jobs -field when modifying their profiles and added Past Jobs are showing in their profile page after saving. Still when we go to our people search center and hover over a user, there is no Past Jobs -field to be seen in the hover panel. Here is what I have done after creating the property:

  • I checked out the people search center's display template "Item_Person_HoverPanel.html" and opened it in advanced editing mode in Sharepoint Designer

  • I added 'PastJobs';'PastJobs' to the managed properties -tag

  • Then I added a line for PastJobs in the list at the beginning like this:

    var has_pj = !$isEmptyString(ctx.CurrentItem.PastJobs);

  • After that I copied the Past Projects -entry and modified all "PastProject" -words into "PastJobs" in that entry like this:

Copied this

<!--#_                    
                            if(has_pp == true) {
                                var encodedVal = Srch.U.getTrimmedProcessedHHXMLString(Srch.U.getMultipleHHXMLNodeValues(hhProps, "pastprojects", 5, delimiter), 145);
                                if (Srch.U.e(encodedVal)) { encodedVal = $htmlEncode(Srch.U.getTrimmedString(Srch.U.getUnEncodedMultiValuedResults(ctx.CurrentItem.PastProjects, 5, delimiter), 145)) }
                                if (!Srch.U.e(encodedVal)) {
                                    infoAvailable = true;
_#-->                        
                                    <li id="PastProjectsField">
                                        <div class="ms-srch-hover-subTitle"><h3 class="ms-soften">_#= $htmlEncode(Srch.Res.hp_PeopleItem_PastProjects) =#_</h3></div>
                                        <div class="ms-srch-hover-text" id="_#= $htmlEncode(id + HP.ids.peoplePastProjects) =#_">
                                            _#= encodedVal =#_
                                        </div>
                                    </li>
<!--#_ 
                                } 
_#-->
<!--#_                                                                            
                            }                
_#-->

And modified it like this:

<!--#_                    
                            if(has_pj == true) {
                                var encodedVal = Srch.U.getTrimmedProcessedHHXMLString(Srch.U.getMultipleHHXMLNodeValues(hhProps, "pastjobs", 5, delimiter), 145);
                                if (Srch.U.e(encodedVal)) { encodedVal = $htmlEncode(Srch.U.getTrimmedString(Srch.U.getUnEncodedMultiValuedResults(ctx.CurrentItem.PastJobs, 5, delimiter), 145)) }
                                if (!Srch.U.e(encodedVal)) {
                                    infoAvailable = true;
_#-->                        
                                    <li id="PastJobsField">
                                        <div class="ms-srch-hover-subTitle"><h3 class="ms-soften">_#= $htmlEncode(Srch.Res.hp_PeopleItem_PastJobs) =#_</h3></div>
                                        <div class="ms-srch-hover-text" id="_#= $htmlEncode(id + HP.ids.peoplePastJobs) =#_">
                                            _#= encodedVal =#_
                                        </div>
                                    </li>
<!--#_ 
                                } 
_#-->
<!--#_                                                                            
                            }                
_#-->

EDIT: I went into Sharepoint Online Admin Center -> Search -> Schema and I searched with the word "Past" for managed properties. It returned three results: owstaxIdPastJobs, owstaxIdSPShPastProjects and PastProjects but not PastJobs even as I named the new property as PastJobs when I created it in the user profile management -> user property management.. should there be PastJobs as well or is owstaxIdPastJobs enough (even though I have no idea where that name comes from)?

EDIT 2: It's been many days now (=should be indexed and crawled and so on) and I have noticed that we can't even search with the past jobs so I think there is something important missing from the property preventing it from used as a keyword in search?

EDIT 3: I created a new managed property called "PastJobs" and mapped it to the crawled property that was created automatically after the user profile property creation. Even after this I still cannot find any Past Jobs via search.

EDIT 4: Here are screenshots of our managed properties and crawled properties with the search keyword "Past".

Managed propertiesCrawled Properties

I'm quite an amateur in these coding things so I will be really, really grateful for any help regarding this problem! :-)

7
  • When you execute a search for it does it work? i.e. PastJobs="Some past job here"
    – Bunzab
    Commented Sep 4, 2014 at 8:29
  • No it does not seem to find anything via search using PastJobs="some job" or just with the job :/
    – Tenttu
    Commented Sep 4, 2014 at 9:00
  • Do I need to manually create a managed property "PastJobs" in the Admin Center -> Search -> Search Schema and link it to People:PastJobs or should everything work/generate automatically after creating the new user profile property in Admin Center -> User Profiles -> Manage User Properties?
    – Tenttu
    Commented Sep 4, 2014 at 10:59
  • It should be done for you. But you should check to confirm. I'll apologise for the stupid questions in advance but have you ran a crawl since adding the property and have there been any values added??
    – Bunzab
    Commented Sep 4, 2014 at 11:15
  • @Bunzab: Yeah I created the property in User Profile/Property Management in the Admin Center and named it "PastJobs". After that One of our users typed in her past jobs in that field and saved it. Now it can be seen in her profile but not via search and/or the hover panel. It is not found in Managed Properties list in Admin Center either. Only the "cwstaxIdPastJobs" can be found on the list. Also we waited a full 24 hours after the user entered her jobs in the Past Jobs -field in her profile. As for the crawl, we are on Sharepoint Online and I understand the crawl is automated. :-)
    – Tenttu
    Commented Sep 4, 2014 at 11:24

1 Answer 1

2

you are working in the right direction and this is actually the correct way to implement this. Just verify that your new property reference is added in "Item_Person.html" . If that is missing it won't work :)

                <mso:ManagedPropertyMapping msdt:dt="string">'PastJobs':'PastJobs','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'</mso:ManagedPropertyMapping>
6
  • Thank you for your answer! I actually have it mapped already. Does it have to be the first property in that list like in your example? I have 'PastJobs':'PastJobs' after 'PastProjects':'PastProjects'. I wonder what's wrong.. feels like everything should be in order for it to work! :P
    – Tenttu
    Commented Sep 15, 2014 at 8:50
  • Somehow I can't get it to work.. any idea what could be wrong? It can't be a big problem because everything seems to be pretty much in order.. :)
    – Tenttu
    Commented Sep 22, 2014 at 5:54
  • I think problem is before display template. First verify whether the managed property is crawled. Go to Search Service Application in central admin > Search Schema > Managed Properties. And search for "PastJobs". If the name is displayed then use the same name in ManagedPropertyMapping. I guess it should be something like ows_PastJobs. If everything is correct there and still you are not able to get the desired output. Open search site in Google Chrome and debug display templates.There might be some very small mistake :)
    – Manu Singh
    Commented Sep 22, 2014 at 6:44
  • I searched for "PastJobs" in Schema > Managed Properties and it returned 2 results "PastJobs" and "owstaxIdPastJobs". "PastJobs" has been created by me and "owstaxIdPastJobs" was generated when I created the user profile property. I have linked "PastJobs" to crawled property "People:PastJobs". I have "PastJobs" in ManagedPropertyMapping. The problem is that I can't even search Past Jobs with people search.. It doesn't return any results.. I'm beginning to lose hope with this.. :D
    – Tenttu
    Commented Sep 22, 2014 at 7:05
  • When you add extra managed properties into display template, you when need to go to Search Results Types (which is under Site Collection Administration) and there should be yellow ribbon with Update link, after update it should work.
    – martusha
    Commented Oct 8, 2015 at 12:54

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.