SharePoint Online Column Button not working from Gallery View

SarahK 21 Reputation points
2021-07-12T04:27:31.627+00:00

I have created a list in SharePoint online and successfully created a button which activates a flow using power automate. I have created several customised views including gallery views however the button does not work when in gallery view. Is this a JSON customisation issue or does SharePoint not support use of buttons in gallery view?

Microsoft 365 and Office | SharePoint | For business | Windows
0 comments No comments
{count} votes

4 answers

Sort by: Most helpful
  1. Mcintosh, Rebecca 46 Reputation points
    2025-02-27T12:00:52.6433333+00:00

    I actually got it to work after all, with much playing around with the JSON!

    So I had to add the customRowAction and all the formatting of the button from my column along with the columnFormatterReference and then set the customRowAction for the container itself to none.

    Snippet below which is hopefully helpful!

    {
     "elmType": "div",
     "attributes": {
    "class": "=if([$Status] == 'Awaiting Approval', 'ms-bgColor-tealLight ms-bgColor-teal--hover ms-fontColor-white ms-fontSize-12 ms-fontWeight-bold', 'ms-bgColor-transparent ms-bgColor-neutralQuaternaryAlt--hover ms-fontColor-neutralQuaternary ms-fontColor-tealLight--hover ms-fontSize-12')"
     },
    "customRowAction": {
    "action": "setValue",
    "actionInput": {
    "Status": "Approved"
     }
     }
     },
     {
    "elmType": "div",
    "attributes": {
    "class": "ms-bgColor-white sp-css-borderColor-neutralLight sp-card-borderHighlight sp-card-subContainer"
     },
    "customRowAction": {
    "action": "none"
     },
     "children": [
              {
                "elmType": "div",
                "attributes": {
                  "class": "sp-card-displayColumnContainer"
                },
                "children": [
                  {
                    "columnFormatterReference": "[$ChangeStatus]"
                  }
                ]
              },
    
    
    1 person found this answer helpful.
    0 comments No comments

  2. Allen Xu_MSFT 13,866 Reputation points
    2021-07-12T09:11:16.17+00:00

    Hi @SarahK ,

    You can refer to a column's formatter JSON inside Gallery view formatter and use it along with other elements to build a custom view visualization. This can be done by using columnFormatterReference property. There is a demo for your reference: Column formatter reference. Set "columnFormatterReference": [$<your button column name>] in the JSON code and apply the code to the Gallery view formatting.

    Test on my end:
    113816-image.png
    113817-image.png


    If an Answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


  3. James Moyle - Royal High School 1 Reputation point
    2022-04-28T19:45:24.203+00:00

    This was helpful in getting the button to appear correctly, but I still have an issue. Clicking on any part of the Galler Card opens the item


  4. James Moyle - Royal High School 1 Reputation point
    2025-02-27T10:27:01.5166667+00:00

    Sadly not - I got over it 🙂

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.