<?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: Get Current User who invokes particular step in the w... in Adobe Experience Manager Questions</title>
    <link>https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/get-current-user-who-invokes-particular-step-in-the-workflow/m-p/376030#M17346</link>
    <description>&lt;P&gt;&lt;LI-USER uid="17381650"&gt;&lt;/LI-USER&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;I understand that you need the userId of the most recent participant in your workflow. This can be fetched as follows:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Step1: workflowSession.getHistory. This should return the history of workflow:&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;List&lt;/SPAN&gt;&amp;lt;&lt;SPAN&gt;HistoryItem&lt;/SPAN&gt;&amp;gt; &lt;SPAN&gt;histories &lt;/SPAN&gt;= workflowSession.getHistory(workItem.getWorkflow());&lt;/PRE&gt;&lt;P&gt;Step2: The most recent action of the participant user should be the first item in the histories list at index 0, and this can be accessed as:&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;HistoryItem recentHistory &lt;/SPAN&gt;= &lt;SPAN&gt;histories&lt;/SPAN&gt;.get(&lt;SPAN&gt;0&lt;/SPAN&gt;);&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;Step3: The recent user id can be fetched using the getUserId method of HistoryItem:&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;String recentUser &lt;/SPAN&gt;= &lt;SPAN&gt;recentHistory&lt;/SPAN&gt;.getUserId();&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please let me know if this works.&lt;/P&gt;</description>
    <pubDate>Mon, 24 Aug 2020 10:28:31 GMT</pubDate>
    <dc:creator>Fanindra_Surat</dc:creator>
    <dc:date>2020-08-24T10:28:31Z</dc:date>
    <item>
      <title>Get Current User who invokes particular step in the workflow.</title>
      <link>https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/get-current-user-who-invokes-particular-step-in-the-workflow/m-p/375957#M17342</link>
      <description>&lt;P&gt;I&amp;nbsp; tried to get current user using session and authorizable. But none of them giving the current user who invokes the particular step.&lt;/P&gt;&lt;P&gt;Is there any other way to get the current user details ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 24 Aug 2020 05:49:07 GMT</pubDate>
      <guid>https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/get-current-user-who-invokes-particular-step-in-the-workflow/m-p/375957#M17342</guid>
      <dc:creator>JJ_JayantJain</dc:creator>
      <dc:date>2020-08-24T05:49:07Z</dc:date>
    </item>
    <item>
      <title>Re: Get Current User who invokes particular step in the w...</title>
      <link>https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/get-current-user-who-invokes-particular-step-in-the-workflow/m-p/375964#M17343</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;LI-USER uid="17381650"&gt;&lt;/LI-USER&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can use getInitiator() method of Workflow API to get the user ID of the user who started the workflow.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Refer&amp;nbsp;&lt;A href="https://helpx.adobe.com/experience-manager/6-3/sites/developing/using/reference-materials/javadoc/com/adobe/granite/workflow/exec/Workflow.html" target="_blank"&gt;https://helpx.adobe.com/experience-manager/6-3/sites/developing/using/reference-materials/javadoc/com/adobe/granite/workflow/exec/Workflow.html&lt;/A&gt;&amp;nbsp;API to get to know more about this particular method.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;String getInitiator()
Returns the initiator of the Workflow instance.
Returns:
The user who initiated the Workflow.&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope it helps!&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;Nupur&lt;/P&gt;</description>
      <pubDate>Mon, 24 Aug 2020 06:21:00 GMT</pubDate>
      <guid>https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/get-current-user-who-invokes-particular-step-in-the-workflow/m-p/375964#M17343</guid>
      <dc:creator>Nupur_Jain</dc:creator>
      <dc:date>2020-08-24T06:21:00Z</dc:date>
    </item>
    <item>
      <title>Re: Get Current User who invokes particular step in the w...</title>
      <link>https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/get-current-user-who-invokes-particular-step-in-the-workflow/m-p/375970#M17344</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;LI-USER uid="17381650"&gt;&lt;/LI-USER&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In your execute method try the following&lt;/P&gt;&lt;LI-CODE lang="java"&gt;workItem.getWorkflow().getInitiator()&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;-Kalyan&lt;/P&gt;</description>
      <pubDate>Mon, 24 Aug 2020 06:27:02 GMT</pubDate>
      <guid>https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/get-current-user-who-invokes-particular-step-in-the-workflow/m-p/375970#M17344</guid>
      <dc:creator>kalyan_venkat</dc:creator>
      <dc:date>2020-08-24T06:27:02Z</dc:date>
    </item>
    <item>
      <title>Re: Get Current User who invokes particular step in the w...</title>
      <link>https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/get-current-user-who-invokes-particular-step-in-the-workflow/m-p/376004#M17345</link>
      <description>&lt;P&gt;workItem.getWorkflow().getInitiator();&lt;BR /&gt;Gives the details of user who initiated the workflow, which is not my requirement.&lt;BR /&gt;&lt;BR /&gt;I need to get the detail of the user, who currently logged in and running a particular step(process step or dynamic participant step).&lt;/P&gt;</description>
      <pubDate>Mon, 24 Aug 2020 09:10:12 GMT</pubDate>
      <guid>https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/get-current-user-who-invokes-particular-step-in-the-workflow/m-p/376004#M17345</guid>
      <dc:creator>JJ_JayantJain</dc:creator>
      <dc:date>2020-08-24T09:10:12Z</dc:date>
    </item>
    <item>
      <title>Re: Get Current User who invokes particular step in the w...</title>
      <link>https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/get-current-user-who-invokes-particular-step-in-the-workflow/m-p/376030#M17346</link>
      <description>&lt;P&gt;&lt;LI-USER uid="17381650"&gt;&lt;/LI-USER&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;I understand that you need the userId of the most recent participant in your workflow. This can be fetched as follows:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Step1: workflowSession.getHistory. This should return the history of workflow:&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;List&lt;/SPAN&gt;&amp;lt;&lt;SPAN&gt;HistoryItem&lt;/SPAN&gt;&amp;gt; &lt;SPAN&gt;histories &lt;/SPAN&gt;= workflowSession.getHistory(workItem.getWorkflow());&lt;/PRE&gt;&lt;P&gt;Step2: The most recent action of the participant user should be the first item in the histories list at index 0, and this can be accessed as:&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;HistoryItem recentHistory &lt;/SPAN&gt;= &lt;SPAN&gt;histories&lt;/SPAN&gt;.get(&lt;SPAN&gt;0&lt;/SPAN&gt;);&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;Step3: The recent user id can be fetched using the getUserId method of HistoryItem:&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;String recentUser &lt;/SPAN&gt;= &lt;SPAN&gt;recentHistory&lt;/SPAN&gt;.getUserId();&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please let me know if this works.&lt;/P&gt;</description>
      <pubDate>Mon, 24 Aug 2020 10:28:31 GMT</pubDate>
      <guid>https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/get-current-user-who-invokes-particular-step-in-the-workflow/m-p/376030#M17346</guid>
      <dc:creator>Fanindra_Surat</dc:creator>
      <dc:date>2020-08-24T10:28:31Z</dc:date>
    </item>
    <item>
      <title>Re: Get Current User who invokes particular step in the w...</title>
      <link>https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/get-current-user-who-invokes-particular-step-in-the-workflow/m-p/376069#M17347</link>
      <description>final List&amp;lt;HistoryItem&amp;gt; histories = wfSession.getHistory(workItem.getWorkflow()); final HistoryItem firstItem = histories.get(0); String lastParticipant= firstItem.getUserId();</description>
      <pubDate>Mon, 24 Aug 2020 12:45:22 GMT</pubDate>
      <guid>https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/get-current-user-who-invokes-particular-step-in-the-workflow/m-p/376069#M17347</guid>
      <dc:creator>JJ_JayantJain</dc:creator>
      <dc:date>2020-08-24T12:45:22Z</dc:date>
    </item>
    <item>
      <title>Re: Get Current User who invokes particular step in the w...</title>
      <link>https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/get-current-user-who-invokes-particular-step-in-the-workflow/m-p/376070#M17348</link>
      <description>List&amp;lt;HistoryItem&amp;gt; histories = wfSession.getHistory(workItem.getWorkflow()); HistoryItem firstItem = histories.get(0); String currentParticipant= firstItem.getUserId(); As per your response, tried the same code, but its not giving current user. It's giving last user.</description>
      <pubDate>Mon, 24 Aug 2020 12:47:18 GMT</pubDate>
      <guid>https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/get-current-user-who-invokes-particular-step-in-the-workflow/m-p/376070#M17348</guid>
      <dc:creator>JJ_JayantJain</dc:creator>
      <dc:date>2020-08-24T12:47:18Z</dc:date>
    </item>
    <item>
      <title>Re: Get Current User who invokes particular step in the w...</title>
      <link>https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/get-current-user-who-invokes-particular-step-in-the-workflow/m-p/376071#M17349</link>
      <description>problem is still not resolved.</description>
      <pubDate>Mon, 24 Aug 2020 12:51:33 GMT</pubDate>
      <guid>https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/get-current-user-who-invokes-particular-step-in-the-workflow/m-p/376071#M17349</guid>
      <dc:creator>JJ_JayantJain</dc:creator>
      <dc:date>2020-08-24T12:51:33Z</dc:date>
    </item>
    <item>
      <title>Re: Get Current User who invokes particular step in the w...</title>
      <link>https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/get-current-user-who-invokes-particular-step-in-the-workflow/m-p/407567#M17350</link>
      <description>&lt;P&gt;&lt;LI-USER uid="17381650"&gt;&lt;/LI-USER&gt;In such case Have you seen where this current user (expected user) value is stored in the path eg: /var/workflow/instances/server0/2021-03-03/update_asset_12/history/ ?&lt;BR /&gt;I think the way you are traversing to get the latest user is not correct you need to go to the reverse i.e. of the total for (i = HistoryItem length ; i&amp;gt;0 ; i--)&amp;nbsp; , Try once&lt;/P&gt;</description>
      <pubDate>Mon, 10 May 2021 20:12:40 GMT</pubDate>
      <guid>https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/get-current-user-who-invokes-particular-step-in-the-workflow/m-p/407567#M17350</guid>
      <dc:creator>airnavin30</dc:creator>
      <dc:date>2021-05-10T20:12:40Z</dc:date>
    </item>
  </channel>
</rss>

