Adding an Edit button to a modern SharePoint online list item

In classic SharePoint, there was an easy way to show the  “edit” button in a list. If you clicked on it, the edit page would open up. This was a wonderful, easy way to have your users go directly to the edit page of the item.

SharePoint 2010 edit button

In default SharePoint online, there is a different approach: you select the item, open up the right bar (called the “details pane”) and you can see/change the fields there.

New Edit button in modern SharePoint

Sometimes, that is not enough. Sometimes you want a button to go directly to the edit mode, to save a click. It could also help with your adoption, making sure that end users don’t feel lost and don’t feel like they lost a button or functionality.

That is where column formatting comes in. Column formatting lets you choose however a field needs to be displayed. There are various templates available, but you can also go “advanced” and apply or write json script.

Steps

Follow these steps to set it up:

Add a new column: Create a new column, type calculated column (because that doesn’t show up in your new/edit form as a field to fill in) and give it a name. I name it “edit” because that is the same behavior as in classic. Give the field the formula for an empty field: =””.

In the bottom part of the screen, where it says “Column formatting”, add following JSON script:

{
  "$schema": "http://columnformatting.sharepointpnp.com/columnFormattingSchema.json",
  "elmType": "button",
  "customRowAction": {
    "action": "editProps"
  },
  "style": {
    "border": "none",
 "background-color": "transparent"
  },
  "children": [
    {
      "elmType": "span",
      "attributes": {
        "iconName": "Edit"
      }
    }
  ]
}

Hit the save button and watch the new crisp Edit button appear in your list! When you click on it, the details pane opens up in edit mode right away.

The json code is pretty straightforward: show a button, that has the action “editprops” linked to it. You can choose a different button look in the iconName field if you want to. By playing around with the attributes and styles, you can define the looks however you want to.

About: Marijn

Marijn Somers (MVP) has over 14 years experience in the SharePoint world, starting out with SP2007. Over the years the focus has grown to Office 365, with a focus on collaboration and document management. He is a business consultant at Balestra and Principal Content Provider for "Mijn 365 Coach" that offers dutch employee video training. His main work tracks are around user adoption, training and coaching and governance. He is also not afraid to dig deeper in the technicalities with PowerShell, adaptive cards or custom formatting in lists and libraries. You can listen to him on the biweekly "Office 365 Distilled" podcast.


8 thoughts on “Adding an Edit button to a modern SharePoint online list item”

  1. Thank you so much for sharing this tip. It’s so much more user friendly. I’ll be adding this Edit Item column to everything!

  2. That is a great solution, thanks!

    Only noticed, that the icon is not vertically aligned in the middle. No matter what I tried with your code, canĀ“t make it happen. Do you any idea for that?

    1. hmmm, it looks aligned in the middle to me when I change the background to transparant. Could you send me an email at marijn@mijn365coach.be so we can discuss it further? Would love to see your result and see how we change it. That said… please be aware I am not a developer so my CSS knowledge is limited!

  3. Thank You so much. This is so user friendly. How can I hide this column to particular users/permission groups ?

    1. You can’t really… this is just a column in the list and we don’t have real security on that.. You could, as a workaround, use a different view to set it up on, perhaps a personal view… but that is not secure! You only hide it from the users..

Leave a Reply

%d bloggers like this: