In this article, we will see how to use column formatting options to create action buttons in the SharePoint list view for each row. This can be used to customize SharePoint list view and provide options to perform an action on click. This can be achieved using customRowAction attribute in for button element. Before getting into an example, below are 5 actions available which can be used.
- defaultClick - This will simulate item click event (when list item column like the title is clicked)
- share - Opens a sharing dialog
- delete - Opens a delete dialog confirmation popup
- editProps - Opens item properties windows in edit mode
- executeFlow - run MS flow associated based in Flow id (to be configured in JSON, we will see this in the example below)
First, let us start by creating a list. Add below columns for demo
- Title (default)
- Default Action - Calculated column with formula =""
- Share Action - Calculated column with formula =""
- Delete Action - Calculated column with formula =""
- Edit Action - Calculated column with formula =""
- Call Flow - Calculated column with formula =""
As we don't want these columns to be added in List add/edit form, we will create this as a calculated column with an empty string.
Below is an example of the column 'Default Action':

Once you create all the columns, the list would look something like this.

Default Action
To apply column formatting to this column, we have 2 options:
Option 1
Go to List settings, select targeted column settings. In column settings, we will find Column formatting option at the end.
Option 2
Inside list view, select header arrow in the targeted column and follow the below steps.


Add this JSON for default action.
- {
- "$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
- "elmType": "button",
- "customRowAction": {
- "action": "defaultClick"
- },
- "attributes": {
- "class": "ms-fontColor-themePrimary ms-fontColor-themeDark--hover",
- "title": "Open Item"
- },
- "style": {
- "border": "none",
- "background-color": "transparent",
- "cursor": "pointer"
- },
- "children": [
- {
- "elmType": "span",
- "attributes": {
- "iconName": "OpenPane",
- "class": "ms-font-xxl"
- }
- }
- ]
- }

Share action
Edit column and add the below JSON for Share action.
- {
- "$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
- "elmType": "button",
- "customRowAction": {
- "action": "share"
- },
- "attributes": {
- "class": "ms-fontColor-themePrimary ms-fontColor-themeDark--hover",
- "title": "Share Item"
- },
- "style": {
- "border": "none",
- "background-color": "transparent",
- "cursor": "pointer"
- },
- "children": [
- {
- "elmType": "span",
- "attributes": {
- "iconName": "Share",
- "class": "ms-font-xxl"
- }
- }
- ]
- }






Vinay AyinapurapuPosted Jun 10, 2022, 11:15 PM
Nice post siddarth. Is it possible to set field value based on button click
Abdul AjeesPosted Jun 18, 2021, 12:32 PM
I'm trying to update Title column schema for opening the dipform.aspx on same tab instead of opening in new tab. I'm able to do that using following json but Context menu (...) menu is not showing.. Can we open the same tab onclick of title column without affecting context menu..{ "$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json", "elmType": "a", "txtContent": "@currentField", "attributes": { "target": "_self", "class":"ms-Link nameField_79dfe11b clickable_79dfe11b root-190", "href": "= @currentWeb + '/Lists/Time Cards/DispForm.aspx?&Source=https://ttipe.sharepoint.com/sites/dev6/SitePages/Home.aspx&ContentTypeId=0x01008A20F841E6E5124E98AEA82E7B5230D900156D010E8EC724489EBBC8297114CF96&RootFolder=&ID=' + [$ID]" } }