microsoft-search / pnp-modern-search

Home of PnP Modern Search solutions, helping you move from classic to modern SharePoint and beyond
https://microsoft-search.github.io/pnp-modern-search
Other
388 stars 340 forks source link

Person-Card component no longer works within layouts > People > Manage people fields #3939

Open Justin-Nash opened 2 months ago

Justin-Nash commented 2 months ago

Version used 4.12.2

Describe the bug In older versions of PnP Modern Search we were able to use Microsoft Graph Person-Card component to render a manager display name based on the managers email address returned in search after configuring a managed property Manager.

This was working well allowing users to see both the user information on the person they where looking for and that persons manager without having to click through pop ups.

The issue now is that the Microsoft Graph Person-Card component no longer works within the "Manage people fields" section. The last known working version was 4.9. We haven't tested ever version between 4.9 and 4.12.2 but I know the issue exists in:

To Reproduce Detailed steps to reproduce the behavior:

  1. Add a new PnP - Search Results web part to a page
  2. Select SharePoint Search
  3. Set Result Source Id/ Scope|Name to LocalPeopleResults
  4. Select Next so you are on page 2
  5. Select People under Handlebars/HTML
  6. Select Managed card fields
  7. Select the edit icon for *Primary text
  8. Replace {{slot item @root.slots.UserDisplayName}} with <mgt-person user-id="{{getUserEmail (slot item @root.slots.UserEmail)}}" view="oneline"></mgt-person>
  9. Save, Save and Publish

Expected behavior We expect to see the Users Name in the first field. As demonstrated in the screenshots.

Screenshots Expected outcome: image

Actual outcome: image

Desktop (please complete the following information):

Additional context The above steps are a simplified version of what we do with a Manager field. For our environment using a users email or UPN is not a valid option as they do not include the users name in full or in any consistent order.

kasperbolarsen commented 2 months ago

HI, you are right, that doesn't seem to work

Perhaps a custom template like this can resolve the issue: image

In order for it to work you will have to set a slot to "Manager" and in my case the manager managed property was mapped to a RefinableString , but I guess you can use the auto generated one as well. Remember to add it to "selected properties" as well

{{#if @root.properties.showSelectedFilters}} {{/if}}
{{#if @root.properties.showResultsCount}}
{{/if}}
    {{#each data.items as |item|}} {{/each}}
{{#if @root.properties.paging.showPaging}} {{#gt @root.data.totalItemsCount @root.properties.paging.itemsCountPerPage}} {{/gt}} {{/if}}
{{#if @root.properties.showResultsCount}}
{{/if}}
    {{#times @root.properties.paging.itemsCountPerPage}} {{/times}}