If you need to add custom buttons as below to open SharePoint Online forms from list items (with the same behaviour as if you opened them using the out-of-the-box options), you can add them easily by using list formatting JSON, as below:
The main point here is to add a customRowAction element to a JSON template. This row action will allow you to call several list item out-of-the-box actions from the custom button/HTML element. For the edit button (launches a list form in edit mode) you can use the ‘edit action, and for the view one (launches a list form in display only mode) you can use the defaultClick action.
To use those buttons you need simply to add a ‘dummy’ column to your SharePoint list/view to work as a placeholder for the buttons (I normally use a calculated column so it never appear in forms), and then you can reuse the below as JSON template for the columns, for each button:
More About This Author
SharePoint and Office 365 Consultant/Developer always trying to get the best from Microsoft stack (Microsoft 365/Azure/Power Platform and related stuff).
Living in Ireland since 2018, I had previously worked in Brazil as a consultant/developer for Office 365, SharePoint and related technologies for almost 10 years.
- ModernWorkplace2022.06.08Updating list views JSON formatters for a SharePoint list using Power Automate
- ModernWorkplace2022.05.19SharePoint lists custom View and Edit Buttons using JSON Formatting
- ModernWorkplace2022.05.14Power Apps: Patch data from the Office 365 Users connector to a SharePoint multi-user field without using collect
- ModernWorkplace2022.04.30Glossary View formatting: JSON Template including Related Link