how to call bonita External api from javascript variable in form
Hello
i use bonitasoft 2022.2, i have table to display data, in this table there is id column and name column, for each $item.id in the table, i want to call bonitasoft api that return name , and display it in for each item in table:
So i have used this javascript function to pass my item.id to js function to retrieve this item in variable called selected_case:
return{
contextApi : function(item){
$data.selected_case = item
return $data.caseContext
}
}
and i call this function in the table like that :
call.contextApi($item.id)
and my external api variable caseContext :
../API/bpm/case/{{selected_case}}/context
and a display the result of the api in the table in text :
{{caseContext}}
but the result i get just the last item, not for each item i get the right result from the api!
how can i call the api and get the right value foreach item?
I have the same problem.
I have a userList getted from : ../API/identity/user?p=0&c=199
I iterate this list with a for, and I get the user information about groups with another API external:
getUserGroups = /bonita/API/identity/membership?p=0&c=10&f=user_id%3d{{selectedUser}}&d=role_id&d=group_id
let rdList = [];
for (let i = 0; i < $data.userList.length; i++) {
$data.selectedUser = $data.userList[i];
rdList.push($data.getUserGroups);
}
return rdList;
And i receive a list with a userList length, but with the information of the last user in all the lines.
Than you.