Can the system account initiate the workflow on behalf of User

  • 18 October 2017
  • 7 replies
  • 74 views

Badge +5

My scenario is, I have one document library which is read only to everyone. However, any users can request for deleting the document in it. I have a customize delete button on the ribbon (not OOTB delete button), this delete button will trigger the event to capture the comment of user (why he/she want to delete this document). After the user input the comment and submit for deletion, the workflow start kick-off. Can we trigger the workflow with system account like impersonate from this button event? To run the workflow directly from the library, the user should have at least contribute permission, right?

Did anyone implement this kind of situation? Kindly advise if there a way to initiate the workflow with system account? 

Thanks.


7 replies

Userlevel 5
Badge +14

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.

Userlevel 6
Badge +16

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.

Badge +5

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?

Badge +5

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 happy.png

Userlevel 5
Badge +14

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.

Badge +5

Thanks a lot Marian, I will try with this approach as well. happy.png

Userlevel 6
Badge +16

Have you tried it? Please set it as answered

Reply