# get all archieved username

**URL:** <https://community.ofelia.com/t/get-all-archieved-username/9430>\
**Category:** Q&A\
**Created:** [30 January 2019 10:24 UTC](https://community.ofelia.com/t/get-all-archieved-username/9430 "2019-01-30T10:24:31Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![ramireddy.pingala](https://avatars.discourse-cdn.com/v4/letter/r/f14d63/32.png) [@ramireddy.pingala](https://community.ofelia.com/u/ramireddy.pingala)\
**Post date:** [30 January 2019 10:24 UTC](https://community.ofelia.com/t/get-all-archieved-username/9430/1 "2019-01-30T10:24:31Z")

</div>

I want to get all the archieved task usernames.Please help me thank you in advance.

---

<div class="post-metadata">

**Author:** ![system](https://europe1.discourse-cdn.com/flex013/uploads/community_bonitasoft/original/2X/6/6b7b18c0478f2645369e82e009b65e3b97f2cc12.svg) [@system](https://community.ofelia.com/u/system)\
**Post date:** [30 January 2019 13:21 UTC](https://community.ofelia.com/t/get-all-archieved-username/9430/2 "2019-01-30T13:21:08Z")

</div>

I recommend you read about Bonita Engine API in the documentation.  
More precisely you should take a look at BPM and Identity APIs.

With [BPM API](https://documentation.bonitasoft.com/bonita/7.8/bpm-api) you will be able to get information about ArchivedHumanTask and with [IdentityAPI](https://documentation.bonitasoft.com/bonita/7.8/identity-api) you get information about the user based on the user id you will get in ArchivedHumanTask.

---

<div class="post-metadata">

**Author:** ![ramireddy.pingala](https://avatars.discourse-cdn.com/v4/letter/r/f14d63/32.png) [@ramireddy.pingala](https://community.ofelia.com/u/ramireddy.pingala)\
**Post date:** [31 January 2019 09:11 UTC](https://community.ofelia.com/t/get-all-archieved-username/9430/3 "2019-01-31T09:11:50Z")

</div>

Can you please explain it, because still i am not able to get the archieved username  
Suppose i have 4 human tasks (step1 , step2 , step3, step4) for step1 the user is walter.bates and for step2 user is helen.kelly step3 user is william.jobs

So, now my aim is in step2 i want to display step1 username and in step3 i want display step1 and step2 username both same as in step4 i want to display step1 , step2 and step3 username

Thanks you

---

<div class="post-metadata">

**Author:** ![ramireddy.pingala](https://avatars.discourse-cdn.com/v4/letter/r/f14d63/32.png) [@ramireddy.pingala](https://community.ofelia.com/u/ramireddy.pingala)\
**Post date:** [4 February 2019 09:33 UTC](https://community.ofelia.com/t/get-all-archieved-username/9430/4 "2019-02-04T09:33:44Z")

</div>

please help me in this scenariao, still i am facing the problem.

---

<div class="post-metadata">

**Author:** ![ramireddy.pingala](https://avatars.discourse-cdn.com/v4/letter/r/f14d63/32.png) [@ramireddy.pingala](https://community.ofelia.com/u/ramireddy.pingala)\
**Post date:** [4 February 2019 18:01 UTC](https://community.ofelia.com/t/get-all-archieved-username/9430/5 "2019-02-04T18:01:09Z")

</div>

help me i am strucked on this task appreciate in advance

---

<div class="post-metadata">

**Author:** ![Dibyajit.Roy](https://avatars.discourse-cdn.com/v4/letter/d/7ea924/32.png) [@Dibyajit.Roy](https://community.ofelia.com/u/Dibyajit.Roy)\
**Post date:** [7 February 2019 07:44 UTC](https://community.ofelia.com/t/get-all-archieved-username/9430/6 "2019-02-07T07:44:59Z")

</div>

Hello  
Using the BPM Api you can retrieve the executed by (user id of the task completor).  
Now using Identity APi, pass the user id and it will return the username.  
You can use a repeatble container and create a widget for the same.  
This way it will list all the tasks and show who completed them.  
  
Regards

---

<div class="post-metadata">

**Author:** ![ramireddy.pingala](https://avatars.discourse-cdn.com/v4/letter/r/f14d63/32.png) [@ramireddy.pingala](https://community.ofelia.com/u/ramireddy.pingala)\
**Post date:** [10 February 2019 09:33 UTC](https://community.ofelia.com/t/get-all-archieved-username/9430/7 "2019-02-10T09:33:51Z")

</div>

Thank you&nbsp;_Dibyajit.Roy,_

_I got the solution , but now my problem is in my case i want username and userID_

_i am able to get both&nbsp;username and userID_

**_[{"UserID" : "1" "taskName" : "Step1"}]&nbsp; [{"Username"&nbsp; :&nbsp; "walterbates"}]&nbsp;_**

**_[{"UserID" : "2" "taskName" : "Step2"}]&nbsp; [{"Username"&nbsp; :&nbsp; "helen.kelly"}]&nbsp; &nbsp;_**

_But i want the solution like below_

**_[{"UserID" : "1" "taskName" : "Step2"&nbsp; "Username"&nbsp; :&nbsp; "walterbates"}]_**

**_[{"UserID" : "2" "taskName" : "Step3"&nbsp; &nbsp;"Username"&nbsp; :&nbsp; "helen.kelly"}]_**

**_[{"UserID" : "3" "taskName" : "Step4"&nbsp; &nbsp;"Username"&nbsp; :&nbsp; "williamjobs"}]_**

&nbsp;

**_please help me thanks in advance_**

---

<div class="post-metadata">

**Author:** ![Dibyajit.Roy](https://avatars.discourse-cdn.com/v4/letter/d/7ea924/32.png) [@Dibyajit.Roy](https://community.ofelia.com/u/Dibyajit.Roy)\
**Post date:** [10 February 2019 10:06 UTC](https://community.ofelia.com/t/get-all-archieved-username/9430/8 "2019-02-10T10:06:52Z")

</div>

You can Format the Data the way you want to.  
First use a container. Set the Value of the Container to the Rest API variable.  
Now using Text widget placed side by side.

\<B\>User id\</B\> {{$item.executedBy}}&nbsp;&nbsp;\<B\>Task name\</B\> {{$item.taskname}}&nbsp; set&nbsp;Fragment here

For the Fragment, pass the executedBy id and inside the fragment, create a External API variable of identitiy type. Use a text widget inside the Fragment to show the output of the Identity API. This will show Username  
  
Since you placed the fragment inside the repeatble container.and each iteration of Container will pass the Executed by ..hence the fragment will display the usernames in Proper order..  
  
Overall your page alignment will determine how it looks.

&nbsp;

Regards

---

<div class="post-metadata">

**Author:** ![ramireddy.pingala](https://avatars.discourse-cdn.com/v4/letter/r/f14d63/32.png) [@ramireddy.pingala](https://community.ofelia.com/u/ramireddy.pingala)\
**Post date:** [10 February 2019 12:25 UTC](https://community.ofelia.com/t/get-all-archieved-username/9430/9 "2019-02-10T12:25:55Z")

</div>

hi,

actually how i am doing i will show the code then you can get the idea what i want exactly

### **1 ) variable ---- getUsers**

**type ---- externalAPI**

**value ----&nbsp;../API/bpm/archivedHumanTask?p=0&c=100&f=caseId={{parentCaseId}}**

### &nbsp;

### **2 ) variable ---- getUserByTask**

**type ---- JavaScript Expression**

var data = $data.getUsers;  
var taskarray = [];  
for(var i = 0 ;i\<data.length;i++){  
&nbsp; &nbsp; var task = data[i].executedBy;  
&nbsp; &nbsp; taskarray.push(task);  
}  
return taskarray;

### **3 ) variable ---- getuserById1&nbsp;**

**type ---- externalAPI**

**value ----&nbsp;../API/identity/user/{{getUserByTask[0]}}**

&nbsp;

### **4 ) variable ---- getuserById2**

**type ---- externalAPI**

**value ----&nbsp;../API/identity/user/{{getUserByTask[1]}}**

&nbsp;

&nbsp;

now from this 3 and 4 points i am getting static value i.e ({getUserByTask[0],&nbsp;{getUserByTask[1]) so i donot want to use 0 ,1, 2 ,3 ...... like that. From this variables for userName i want to use&nbsp; **getuserById1.userName** and&nbsp; **getuserById2.userName** , now my aim is if i use&nbsp; **getuserById.userName** all the usernames want to come in based **on point 2&nbsp;&nbsp;** thats it then i want to get all the userNames. Thanks in advance

---

<div class="post-metadata">

**Author:** ![Dibyajit.Roy](https://avatars.discourse-cdn.com/v4/letter/d/7ea924/32.png) [@Dibyajit.Roy](https://community.ofelia.com/u/Dibyajit.Roy)\
**Post date:** [10 February 2019 12:34 UTC](https://community.ofelia.com/t/get-all-archieved-username/9430/10 "2019-02-10T12:34:58Z")

</div>

Hello  
Could you share the Page in google Drive.  
Add the Page to a location in google Drive and send me the link in dbyajitroy@gmail.com or paste the link here.  
I will take a look and update if Possible.

---

<div class="post-metadata">

**Author:** ![ramireddy.pingala](https://avatars.discourse-cdn.com/v4/letter/r/f14d63/32.png) [@ramireddy.pingala](https://community.ofelia.com/u/ramireddy.pingala)\
**Post date:** [10 February 2019 13:07 UTC](https://community.ofelia.com/t/get-all-archieved-username/9430/11 "2019-02-10T13:07:46Z")

</div>

sure i shared

---

<div class="post-metadata">

**Author:** ![ramireddy.pingala](https://avatars.discourse-cdn.com/v4/letter/r/f14d63/32.png) [@ramireddy.pingala](https://community.ofelia.com/u/ramireddy.pingala)\
**Post date:** [10 February 2019 13:10 UTC](https://community.ofelia.com/t/get-all-archieved-username/9430/12 "2019-02-10T13:10:46Z")

</div>

https://drive.google.com/open?id=1KdGbvJay2eMEeJSr4sXkY6hB6SC44Hep

---

<div class="post-metadata">

**Author:** ![Dibyajit.Roy](https://avatars.discourse-cdn.com/v4/letter/d/7ea924/32.png) [@Dibyajit.Roy](https://community.ofelia.com/u/Dibyajit.Roy)\
**Post date:** [10 February 2019 13:27 UTC](https://community.ofelia.com/t/get-all-archieved-username/9430/13 "2019-02-10T13:27:35Z")

</div>

Ok.. I will check and reply back to you.

---

<div class="post-metadata">

**Author:** ![Dibyajit.Roy](https://avatars.discourse-cdn.com/v4/letter/d/7ea924/32.png) [@Dibyajit.Roy](https://community.ofelia.com/u/Dibyajit.Roy)\
**Post date:** [10 February 2019 18:52 UTC](https://community.ofelia.com/t/get-all-archieved-username/9430/14 "2019-02-10T18:52:20Z")

</div>

Hello  
I am using the Subscription version.  
I just checked the community version. The Option to create Fragmens is not there. Hence to display username would become very difficult. Fragments allow you to create widgets which can process data seperate and return expected outcome. You can build amazing widgets with Fragments. I use a lot of them.  
Unfortunate its not there in community edition.  
I have just modifed the form to show how you can bind data to container and use that as a repeatble container.  
The value of the container is set to the API response and then using $item we can sort through the data. No need to write any code for that.  
Maybe I may have used&nbsp;the wrong variable name for userid and taskname.  
Just correct them and do a Preview, it should show a pattern of repeating sections. Try to lay around with the last segment where I set the executed By method.  
Here is the Drive link.

[https://drive.google.com/file/d/1OCVqggsouWhpcFI9VuP1wREvlF8z3wbA/view?usp=sharing](https://drive.google.com/file/d/1OCVqggsouWhpcFI9VuP1wREvlF8z3wbA/view?usp=sharing)&nbsp;

Regards

---

<div class="post-metadata">

**Author:** ![ramireddy.pingala](https://avatars.discourse-cdn.com/v4/letter/r/f14d63/32.png) [@ramireddy.pingala](https://community.ofelia.com/u/ramireddy.pingala)\
**Post date:** [11 February 2019 08:42 UTC](https://community.ofelia.com/t/get-all-archieved-username/9430/15 "2019-02-11T08:42:53Z")

</div>

Now I am able to get my scenariao but i am passing static data to get the output username iteration please check . In the form once check&nbsp; **auditTrailDetail&nbsp;** varable , in that i am wirting if conditions now in my case i have only 5 tasks so we can write if condition but if i have 1000 tasks then we can't compare with if case that's why i am asking for dynamic value

var getAuditDetailJSON = [];

getAuditDetailJSON = $data.auditDetails;  
var auditTrail = [];

for(var i= 0;i\<getAuditDetailJSON.length;i++){  
&nbsp; &nbsp; var userId = getAuditDetailJSON[i].executedBy;  
&nbsp; &nbsp; var taskName = getAuditDetailJSON[i].displayName;  
&nbsp; &nbsp; var dateTime = getAuditDetailJSON[i].archivedDate;

&nbsp; &nbsp; &nbsp;if(i===0){  
&nbsp; &nbsp; var user\_name = $data.getuserById1.userName;  
&nbsp; &nbsp;}  
&nbsp; &nbsp;if(i==1){  
&nbsp; &nbsp; &nbsp; &nbsp;var user\_name = $data.getuserById2.userName;  
&nbsp; &nbsp;}  
&nbsp;  
&nbsp; &nbsp; &nbsp;var x = {user\_name,userId,taskName,dateTime};  
&nbsp; &nbsp;auditTrail.push(x);  
&nbsp; &nbsp; &nbsp; &nbsp;}

&nbsp;var ReverseArray = [];  
&nbsp; &nbsp;var length1 = auditTrail.length;  
&nbsp; &nbsp;for(var i = length1-1;i\>=0;i--){  
&nbsp; &nbsp; &nbsp; &nbsp;ReverseArray.push(auditTrail[i]);  
&nbsp; &nbsp;}

return ReverseArray;

---

<div class="post-metadata">

**Author:** ![ramireddy.pingala](https://avatars.discourse-cdn.com/v4/letter/r/f14d63/32.png) [@ramireddy.pingala](https://community.ofelia.com/u/ramireddy.pingala)\
**Post date:** [11 February 2019 10:21 UTC](https://community.ofelia.com/t/get-all-archieved-username/9430/16 "2019-02-11T10:21:49Z")

</div>

Hi,

User name is not working because in **$item&nbsp;** userName element is not present and not able to submit the form.

Actually i want in same array all the details like taskname , username , userid in single array or json like

[{"userId " :&nbsp; "1" , "username" :&nbsp; "walter" ,&nbsp; "taskName" : "Step1"}]

And check once&nbsp; **auditTrailDetail** variable&nbsp; from that variable i am getting [{ **UserID , taskName** &nbsp;,&nbsp; **timestamp}]&nbsp;** along with this three i want&nbsp;&nbsp; [{ **UserID , taskName** &nbsp;,&nbsp; **timestamp , userName}] username also&nbsp;**

&nbsp;

---

<div class="post-metadata">

**Author:** ![ramireddy.pingala](https://avatars.discourse-cdn.com/v4/letter/r/f14d63/32.png) [@ramireddy.pingala](https://community.ofelia.com/u/ramireddy.pingala)\
**Post date:** [12 February 2019 05:49 UTC](https://community.ofelia.com/t/get-all-archieved-username/9430/17 "2019-02-12T05:49:56Z")

</div>

Hi&nbsp;_Dibyajit.Roy,_

_please help in $item.userName is not working, Thanks in advance._

---

<div class="post-metadata">

**Author:** ![Dibyajit.Roy](https://avatars.discourse-cdn.com/v4/letter/d/7ea924/32.png) [@Dibyajit.Roy](https://community.ofelia.com/u/Dibyajit.Roy)\
**Post date:** [12 February 2019 05:53 UTC](https://community.ofelia.com/t/get-all-archieved-username/9430/18 "2019-02-12T05:53:59Z")

</div>

Sorry, I know that $item.username is not working. I cannot really help you much here.  
I will continue to See if I can do something.  
As i mentioned that Fragments can be used and that option is not there in Community.  
Keep experimenting. If you find a solution, Post it in Community for everyone.

&nbsp;

Regards

---

<div class="post-metadata">

**Author:** ![ramireddy.pingala](https://avatars.discourse-cdn.com/v4/letter/r/f14d63/32.png) [@ramireddy.pingala](https://community.ofelia.com/u/ramireddy.pingala)\
**Post date:** [13 February 2019 04:30 UTC](https://community.ofelia.com/t/get-all-archieved-username/9430/19 "2019-02-13T04:30:40Z")

</div>

Hi&nbsp;&nbsp;_Dibyajit.Roy,_

_you mentioned that we can do in fragments can you please tell me how to do in subscription fragments._

---

<div class="post-metadata">

**Author:** ![system](https://europe1.discourse-cdn.com/flex013/uploads/community_bonitasoft/original/2X/6/6b7b18c0478f2645369e82e009b65e3b97f2cc12.svg) [@system](https://community.ofelia.com/u/system)\
**Post date:** [13 February 2019 09:07 UTC](https://community.ofelia.com/t/get-all-archieved-username/9430/20 "2019-02-13T09:07:55Z")

</div>

Hi&nbsp;Ramireddy,

Dibyajit refer to the Subscription Edition (also named Enterprise Edition) of Bonita. You can learn more about Bonita editions on this page:&nbsp;https://www.bonitasoft.com/bonita-editions

[Next page](https://community.ofelia.com/t/get-all-archieved-username/9430.md?page=2)
