some workflow actions (eg. action set) have an option 'Run as workflow owner' which allows them to run with owner's priviledges instead of initiator one.
so add an 'action set' action to workflow and move into it all the actions you want to run with owner's priviledges.
enable the 'Run as workflow owner' option on action set.
publish workflow with service account.
I suggest that your button should create a new item on a list named "ToBeDeleted" with the Id of the item to be deleted. Then you can create a scheduled workflow that queries the list "ToBeDeleted" and deletes the documents inside that list.
Thanks for your suggestion Marian. Those action set can achieve after triggering the workflow, right? Is there a way to kick off the workflow with workflow owner right?
I like your idea Fernando, I should capture the ID of the item which I want to delete from that library and save it in SharePoint list. Then the workflow will run based on creation of the item. If approved, delete the document from the Library. If not, delete the recorded ID from the current list. I am going to try in this way. Thanks a lot
action set is regular workflow action. so yes, workflow has to run in order action was executed.
despite workflow itself will run with initiator privileges, all the actions within the action set will run with workflow owner privileges.
if you really want to start workflow with owner privileges, you can do it so that you create two workflows.
principle is similar to above, but instead of putting single actions into action set you will start another workflow from within action set. if you configure action set to run with owner's privileges, started workflow will run with these privileges as well.
Thanks a lot Marian, I will try with this approach as well.
Have you tried it? Please set it as answered