SOLVED

SharePoint List button to MS Form

Copper Contributor

Is it possible to have a button in a SharePoint list column that enables the user to be able to click which will take them to a specific MS Forms URL? 

 

Here is my attempt but I just can't seem to get it to work... 

 

2021_12_10_16_16_47_Window.png

 

{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "button",
"style": {
"border": "dark",
"background-color": "green",
"color": "white",
"cursor": "pointer",
"align-items": "left",
"height": "40px"
},
"txtContent": "Button",
"attributes": {
"target": "_blank",
"href": "https://forms.office.com/Pages/ResponsePage.aspx?id=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}
}

1 Reply
best response confirmed by jwf1081 (Copper Contributor)
Solution

@jwf1081 To create a button with hyperlink, change your JSON in below format:

 

{
    "$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
    "elmType": "a",
    "attributes": {
        "href": "https://forms.office.com/Pages/ResponsePage.aspx?id=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
        "target": "_blank"
    },
    "style": {
        "text-decoration": "none"
    },
    "children": [
        {
            "elmType": "button",
            "txtContent": "Go to Client Data",
            "style": {
                "cursor": "pointer",
                "width": "100%"
            }
        }
    ]
}

 

Additionally, you can apply other CSS styles as per your requirements. Check my answer given in this thread: Custom view rowformatter - how to make a hyperlink look like a button 


Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.

1 best response

Accepted Solutions
best response confirmed by jwf1081 (Copper Contributor)
Solution

@jwf1081 To create a button with hyperlink, change your JSON in below format:

 

{
    "$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
    "elmType": "a",
    "attributes": {
        "href": "https://forms.office.com/Pages/ResponsePage.aspx?id=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
        "target": "_blank"
    },
    "style": {
        "text-decoration": "none"
    },
    "children": [
        {
            "elmType": "button",
            "txtContent": "Go to Client Data",
            "style": {
                "cursor": "pointer",
                "width": "100%"
            }
        }
    ]
}

 

Additionally, you can apply other CSS styles as per your requirements. Check my answer given in this thread: Custom view rowformatter - how to make a hyperlink look like a button 


Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.

View solution in original post