Add delete Item and workflows button to forms

Hello there

Is it possible to add a Delete and Workflow buttons to the top of a form?

image

thanking you in advance!

Dear @Jamal_Smith-Graham,
Sure, you'll find how to work with Toolbar buttons in this section - https://plumsail.com/docs/forms-sp/javascript/toolbar.html

Here, you can see an example of how you can launch flow from the button in List or Library, and pass the selected items - https://plumsail.com/docs/forms-sp/how-to/list-or-library-export.html

Your case would be fairly similar, you'll just need to pass current item ID instead, you can get it with:

fd.itemId

We don't recommend using Workflows in this, Power Automate would be a more convenient and easier option.

Alternatively, you can use pnpjs and its requests to delete/manipulate current item instead, something like this:

fd.spRendered(function() {
    fd.toolbar.buttons.push({
        icon: 'Delete',
        class: 'btn-outline-primary',
        text: 'Delete',
        click: function() {
            pnp.sp.web.lists.getByTitle('My List Name').items.getById(fd.itemId).delete().then(function(){
                fd.close();
            });
        }
    });
});
2 Likes

Thank you!

This was just what I needed! :slight_smile: