0

I have a person type field in a sharepoint list. This field accepts both groups and individuals. When hovering over an individual I can see the default person card, but nothing appears when I hover the cursor over a user group in the same field.

Therefore, I have two questions:

  1. There is really no hover card functionality for groups in sharepoint lists or am I missing something?

  2. If there's none, can I implement some functionality for groups using json formatting? If possible, I'd like to show at least the group members in some "group card".

1 Answer 1

0

Below are the answers of your questions according to my knowledge

  1. Hover card functionality is only available user value not for group value
  2. There is no way to get group members using column json formatting.

Workaround 1

You can create custom field customizer using SPFx.

SPFx Extension Samples

Workaround 2

You can render user field in such a way that in case of user value it renders with hover card (which is default functionality) and in case of group value you can generate hyperlink which can redirect user to group page where user can see members of the group.

Following is the JSON for the same. Here in order to identify whether it's group or user I used sip property to identify it because in case of group, sip will be always empty.

 {
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
  "elmType": "div",
  "children": [
    {
      "elmType": "span",
      "defaultHoverField": "@currentField",
      "txtContent": "@currentField.title",
      "style": {
        "display": "=if(@currentField.sip == '','none','block')"
      }
    },
    {
      "elmType": "a",
      "style": {
        "display": "=if(@currentField.sip == '','block','none')"
      },
      "attributes": {
        "href": {
          "operator": "+",
          "operands": [
            "@currentWeb",
            "/_layouts/15/people.aspx?MembershipGroupId=",
            "@currentField.id"
          ]
        },
        "target": "_blank"
      },
      "txtContent": "@currentField.title"
    }
  ]
}

Below is the output of column formatting:

enter image description here

Official Documentation: https://docs.microsoft.com/en-us/sharepoint/dev/declarative-customization/column-formatting

0

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.