AnsweredAssumed Answered

Run workflow script task tenant admin

Question asked by nicoo on Jan 15, 2016
Latest reply on Feb 18, 2019 by hiten.rastogi

I use a custom workflow definition on a multi tenant alfresco 5.0.a (for testing purposes).
In the bpmn process definition there are some script task, which are setting Tags on contained documents.

<serviceTask id="alfrescoScripttask1" name="add tag" activiti:class="org.alfresco.repo.workflow.activiti.script.AlfrescoScriptDelegate">
   <activiti:field name="script">
     <activiti:string><![CDATA[if(bpm_package && bpm_package.children){ for (var i = 0; i < bpm_package.children.length; i++) {  bpm_package.children.addTag("Some tag");  }}]]></activiti:string>

As this is working as expected, I'd like to execute this script as admin. In my naive thinking, I tried to use the "run as" property, like this, as addition to the service task:

<activiti:field name="runAs">

The problem arises with the multi tenant system. Of course the user "admin" is not existing for a tenant, which would be

My question is:
How can I run a script task of a workflow as admin of the "current" tenant (the tenant of the user executing the workflow)?

Thank you very much.