I want to get all the archieved task usernames.Please help me thank you in advance.
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 you will be able to get information about ArchivedHumanTask and with IdentityAPI you get information about the user based on the user id you will get in ArchivedHumanTask.
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
please help me in this scenariao, still i am facing the problem.
help me i am strucked on this task appreciate in advance
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
Thank you 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 username and userID
[{"UserID" : "1" "taskName" : "Step1"}] [{"Username" : "walterbates"}]
[{"UserID" : "2" "taskName" : "Step2"}] [{"Username" : "helen.kelly"}]
But i want the solution like below
[{"UserID" : "1" "taskName" : "Step2" "Username" : "walterbates"}]
[{"UserID" : "2" "taskName" : "Step3" "Username" : "helen.kelly"}]
[{"UserID" : "3" "taskName" : "Step4" "Username" : "williamjobs"}]
please help me thanks in advance
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}} <B>Task name</B> {{$item.taskname}} set 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.
Regards
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 ---- ../API/bpm/archivedHumanTask?p=0&c=100&f=caseId={{parentCaseId}}
2 ) variable ---- getUserByTask
type ---- JavaScript Expression
var data = $data.getUsers;
var taskarray = [];
for(var i = 0 ;i<data.length;i++){
var task = data[i].executedBy;
taskarray.push(task);
}
return taskarray;
3 ) variable ---- getuserById1
type ---- externalAPI
value ---- ../API/identity/user/{{getUserByTask[0]}}
4 ) variable ---- getuserById2
type ---- externalAPI
value ---- ../API/identity/user/{{getUserByTask[1]}}
now from this 3 and 4 points i am getting static value i.e ({getUserByTask[0], {getUserByTask[1]) so i donot want to use 0 ,1, 2 ,3 ...... like that. From this variables for userName i want to use getuserById1.userName and getuserById2.userName, now my aim is if i use getuserById.userName all the usernames want to come in based on point 2 thats it then i want to get all the userNames. Thanks in advance
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.
sure i shared
https://drive.google.com/open?id=1KdGbvJay2eMEeJSr4sXkY6hB6SC44Hep
Ok.. I will check and reply back to you.
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 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
Regards
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 auditTrailDetail 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++){
var userId = getAuditDetailJSON[i].executedBy;
var taskName = getAuditDetailJSON[i].displayName;
var dateTime = getAuditDetailJSON[i].archivedDate;
if(i===0){
var user_name = $data.getuserById1.userName;
}
if(i==1){
var user_name = $data.getuserById2.userName;
}
var x = {user_name,userId,taskName,dateTime};
auditTrail.push(x);
}
var ReverseArray = [];
var length1 = auditTrail.length;
for(var i = length1-1;i>=0;i--){
ReverseArray.push(auditTrail[i]);
}
return ReverseArray;
Hi,
User name is not working because in $item 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 " : "1" , "username" : "walter" , "taskName" : "Step1"}]
And check once auditTrailDetail variable from that variable i am getting [{UserID , taskName , timestamp}] along with this three i want [{UserID , taskName , timestamp , userName}] username also
Hi Dibyajit.Roy,
please help in $item.userName is not working, Thanks in advance.
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.
Regards
Hi Dibyajit.Roy,
you mentioned that we can do in fragments can you please tell me how to do in subscription fragments.
Hi Ramireddy,
Dibyajit refer to the Subscription Edition (also named Enterprise Edition) of Bonita. You can learn more about Bonita editions on this page: https://www.bonitasoft.com/bonita-editions