Forum Discussion

miwidev's avatar
miwidev
Copper Contributor
Sep 19, 2024

Update document item property from custom button in list view

I want to add a custom button to a list view of a sharepoint online document library in order to update a property of the selected document item. (actually just assigning a certain value to a lookup field, considering some kind of custom logic)

Any ideas how to accomplish that? Is there an easy approach with just javascript? Can I do it with power apps or do I need something like SPFx for that requirement?

Any inputs or even examples are greatly appreciated!

  • OludareF's avatar
    OludareF
    Copper Contributor

    Hello,

    Thank you for your question! Adding a custom button to a SharePoint Online document library view to update a property based on custom logic is definitely achievable, and you have a few options depending on the complexity of the logic and your familiarity with different tools.

    1. Using Power Apps: If you're looking for a no-code/low-code approach, Power Apps could be a great fit. You can create a custom form or interface that interacts with the document library and updates the lookup field based on your custom logic. Power Apps provides flexibility and can integrate easily with SharePoint Lists and Document Libraries. It's a more straightforward option if you're already comfortable with the platform.

     

    2. Using Power Automate: Power Automate can be used to create flows triggered by button clicks. While this doesn't directly add a button to the document library view, you could configure it to update a document's property based on specific conditions.

     

    3. JavaScript (via SPFx): For more advanced customization, the SharePoint Framework (SPFx) allows you to build and deploy custom extensions, including buttons in the list view toolbar. You can then use JavaScript to handle the click event and apply your custom logic to update the lookup field. This approach gives you the most control over the user interface and the underlying logic but requires more development effort.

     

    I hope this gives you some direction! Feel free to ask if you need further details or examples.

    miwidev 

Resources