<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Run workflow script task tenant admin in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/run-workflow-script-task-tenant-admin/m-p/280441#M233571</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The only way to deal with this would require you to use an expression instead of a hard-coded user ID. The expression would have to make use of some Java class / code to dynamically determine the correct user name. The Java class&amp;nbsp;org.alfresco.repo.tenant.TenantUtil is typically used to&amp;nbsp;execute code as a specific user in a specific tenant, while the&amp;nbsp;org.alfresco.repo.tenant.TenantService interface provides utilities to translate abstract identifiers (including user names) to tenant specific identifiers.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 15 Feb 2019 09:04:02 GMT</pubDate>
    <dc:creator>afaust</dc:creator>
    <dc:date>2019-02-15T09:04:02Z</dc:date>
    <item>
      <title>Run workflow script task tenant admin</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/run-workflow-script-task-tenant-admin/m-p/280439#M233569</link>
      <description>Hello,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. &amp;lt;serviceTask id="alfrescoScripttask1" name="add tag" activiti:class="org.alfresco.repo.workflo</description>
      <pubDate>Fri, 15 Jan 2016 10:50:04 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/run-workflow-script-task-tenant-admin/m-p/280439#M233569</guid>
      <dc:creator>nicoo</dc:creator>
      <dc:date>2016-01-15T10:50:04Z</dc:date>
    </item>
    <item>
      <title>Re: Run workflow script task tenant admin</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/run-workflow-script-task-tenant-admin/m-p/280440#M233570</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;B&gt;Nico O _&lt;/B&gt;‌&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Were you able to solve this issue? Facing a similar situation here.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers !!!&lt;/P&gt;&lt;P&gt;Hiten Rastogi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Feb 2019 06:59:57 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/run-workflow-script-task-tenant-admin/m-p/280440#M233570</guid>
      <dc:creator>hiten_rastogi1</dc:creator>
      <dc:date>2019-02-15T06:59:57Z</dc:date>
    </item>
    <item>
      <title>Re: Run workflow script task tenant admin</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/run-workflow-script-task-tenant-admin/m-p/280441#M233571</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The only way to deal with this would require you to use an expression instead of a hard-coded user ID. The expression would have to make use of some Java class / code to dynamically determine the correct user name. The Java class&amp;nbsp;org.alfresco.repo.tenant.TenantUtil is typically used to&amp;nbsp;execute code as a specific user in a specific tenant, while the&amp;nbsp;org.alfresco.repo.tenant.TenantService interface provides utilities to translate abstract identifiers (including user names) to tenant specific identifiers.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Feb 2019 09:04:02 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/run-workflow-script-task-tenant-admin/m-p/280441#M233571</guid>
      <dc:creator>afaust</dc:creator>
      <dc:date>2019-02-15T09:04:02Z</dc:date>
    </item>
    <item>
      <title>Re: Run workflow script task tenant admin</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/run-workflow-script-task-tenant-admin/m-p/280442#M233572</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Axel,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As per your suggestion, I inserted an executionListener in the startEvent of the workflow as below&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;&amp;lt;startEvent id="startevent1" name="Start" activiti:formKey="scwf:submitReviewTask"&amp;gt;&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;extensionElements&amp;gt;&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;activiti:executionListener event="end" class="com.xyz.abc.workflow.SetAdminUser" /&amp;gt;&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/extensionElements&amp;gt;&lt;BR /&gt; &amp;lt;/startEvent&amp;gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the&amp;nbsp;&lt;STRONG&gt;SetAdminUser&amp;nbsp;&lt;/STRONG&gt;class, in the end, I set the userName in an execution variable as below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;execution.setVariable("admin", "admin"+SEPARATOR+tenantDomain);&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;and now I am trying to use this username in my runAs field in one of my serviceTask as below&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;&amp;lt;activiti:field name="runAs"&amp;gt;&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;activiti:string&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;![CDATA[execution.getVariable("admin")]]&amp;gt;&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/activiti:string&amp;gt;&lt;BR /&gt; &amp;lt;/activiti:field&amp;gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but the expression isn't resolving and is taken as it is. Hence the below error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;2019-02-18 15:14:16,224 DEBUG [jscript.RhinoScriptProcessor.calls] [http-bio-8080-exec-2] workspace://SpacesStore/486e54d2-0947-4984-b12b-453b8f88609e Exception&lt;BR /&gt; org.mozilla.javascript.WrappedException: Wrapped org.alfresco.service.cmr.workflow.WorkflowException: 01180026 &lt;STRONG&gt;runas user 'execution.getVariable("admin");' does not exist.&lt;/STRONG&gt; (workspace://SpacesStore/486e54d2-0947-4984-b12b-453b8f88609e#12)&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Any help would be great here.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers !!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Feb 2019 10:31:07 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/run-workflow-script-task-tenant-admin/m-p/280442#M233572</guid>
      <dc:creator>hiten_rastogi1</dc:creator>
      <dc:date>2019-02-18T10:31:07Z</dc:date>
    </item>
    <item>
      <title>Re: Run workflow script task tenant admin</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/run-workflow-script-task-tenant-admin/m-p/280443#M233573</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;To answer the above reply I posted we just have to replace the&amp;nbsp;below code in bpmn&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;&lt;SPAN style="color: #000000; background-color: #f6f6f6;"&gt;&amp;lt;activiti:field name="runAs"&amp;gt;&lt;/SPAN&gt;&lt;BR style="color: #000000; background-color: #f6f6f6;" /&gt;&lt;SPAN style="color: #000000; background-color: #f6f6f6;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;activiti:string&amp;gt;&lt;/SPAN&gt;&lt;BR style="color: #000000; background-color: #f6f6f6;" /&gt;&lt;SPAN style="color: #000000; background-color: #f6f6f6;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;![CDATA[execution.getVariable("admin")]]&amp;gt;&lt;/SPAN&gt;&lt;BR style="color: #000000; background-color: #f6f6f6;" /&gt;&lt;SPAN style="color: #000000; background-color: #f6f6f6;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/activiti:string&amp;gt;&lt;/SPAN&gt;&lt;BR style="color: #000000; background-color: #f6f6f6;" /&gt;&lt;SPAN style="color: #000000; background-color: #f6f6f6;"&gt;&amp;lt;/activiti:field&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;with&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;&amp;lt;activiti:field name="runAs"&amp;gt;&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;activiti:expression&amp;gt;${execution.getVariable("admin")}&amp;lt;/activiti:expression&amp;gt;&lt;BR /&gt; &amp;lt;/activiti:field&amp;gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;OR(make it less verbose)&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;&amp;lt;activiti:field name="runAs"&amp;nbsp;&lt;SPAN style="background-color: #f6f6f6;"&gt;expression="${execution.getVariable('admin')}" /&lt;/SPAN&gt;&amp;gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reference:&amp;nbsp;&lt;A class="jivelink1" href="https://www.activiti.org/userguide/#serviceTaskFieldInjection" title="https://www.activiti.org/userguide/#serviceTaskFieldInjection" rel="nofollow noopener noreferrer"&gt;https://www.activiti.org/userguide/#serviceTaskFieldInjection&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers !!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Feb 2019 11:32:25 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/run-workflow-script-task-tenant-admin/m-p/280443#M233573</guid>
      <dc:creator>hiten_rastogi1</dc:creator>
      <dc:date>2019-02-18T11:32:25Z</dc:date>
    </item>
  </channel>
</rss>

