I need to get the BDM objects of an archived case.
Using …/API/bdm/businessDataReference/{{caseId}}/{{myObject}} works for an active case but not for an archived.
What is the API to use? I didn’t find it in the documentation.
A possible solution might be to search among all the business data the one your interested in.
You might want to store the process instance id as a business data attribute to use it in the search query.
Actually Antoine has the right answer but I will phrase it differently.
Business Data shouldn’t be relied on to be stored with the Archived case. This used to be the way before BDM, and I suspect this will change in future releases (not a prediction just a musing).
The point about Business Data is that it should be stored in your database as Business Data and not as part of an archived process, only process data should be stored in that way (even so process data can be stored as business data if required).
Antoine also suggests that the process task ID be used as a reference key to the data, this would also be the right way to go.
The thing here is if you need to do this type of analytical work for process operation again and again you actually need to design a Logging Mechanism for the process and business data so you can recreate a historical version of the process and data flow for auditing.
To do this may require you to change every process to add the logging, so use it carefully, it can generate a lot of data…
You should also be careful of associating a BDM with the actual logged data. For example over time the BDM may change so the data associated with it from a process that is 6 months old may not correlate. It might be necessary to relate the execution of a process not only to the task executed, but also the version of the process/task.
Since I made it work for the project we work on with Maxime, I’ll share what I did. @Antoine and @Sean, could you confirm this is not just a workaround and I can use it as it is ? :
I add the processInstanceId on my bdm object
I get the name of the generated query
On my overviewForm : I call the following request : …/API/bdm/businessData/com.ca.model.TestBDM?q=findBDMObject&p=0&c=10&f=processInst={{caseId}}
where {{caseId}} is the “id” URL parameter and findBDMObject the name of my query
and then I display the result
In fact I found that this works for an archived case as well as for a running case.
The only limitation I can think of is that your business data will be linked to a single process instance.
So you can only search for this process data from this single instance.
I have seen some use cases where several processes manipulate a single business data. In such situation you might want to store multiple process instance ids.
I assume that you have some kind of forms to select an archived process instance and then use the SourceObjectId information to get the “live” process instance id. Is that right?
In fact this is weird (maybe a bug?), but when I display the overview page for an archived case, the URL parameter sourceObjectId stays empty. And the URL param “id” keeps the processInstanceId value…
I try to reproduce your issue but without success. In my test I have both the id (id of the latest archivedProcessInstance entry for the selected process instance) and sourceObjectId (the id of the process instance while the process was running).
Can you share the exact steps to reproduce the issue?
I’m still using 7.1.2 efficiency, I made a bos sample if you want to try it.
To reproduce :
1- Create a process with one step
2- Add an overview page in which you get the URL parameters “id” and “sourceObjectId” and displays it
3- Launch your process
4- Before completion, id is displayed, and sourceObjectId is empty on the overview page
5- After finishing the process, id is still displayed and sourceObjectId is still empty
Actually I did the test and have the same result as you.
In fact URL of the form is the one load in the iframe and it only includes the process instance id. If process instance is archived we still have the same value (that what we call the sourceObjectId).
Only option I can think of here is to use the REST API to get the id of the latest archived instance based on provided source object id.
There is no need to do that, since my request works with the ‘id’ URL.
It is even better because I don’t have to deal whether it is a running case or an archived case.
The only thing is that it might change, since the ‘sourceObjectId’ cannot be reached on the overview archived page
The solution to this issue is to change de Model of the process? I have a process in a production environment with more than 500 cases, the client is asking for a report with the information of the open and closed cases. Should I tell them that the information of the archived cases is not accessible because I didn´t put the reference to the processInstanceId in the model? What is the point of use a bpm tool if I have to take care of this kind of things?
Actually since this recommendation a new REST API is available that let you get the context of the archived case and from those context you have information about URL to call to retrieve business data value: /API/bpm/archivedCase/:archivedCaseId/context
Bonitasoft empowers development teams with Bonita, the open-source and extensible platform to solve the most demanding process automation use cases. The Bonita platform accelerates delivery of complex applications with clear separation between capabilities for visual programming and for coding. Bonita integrates with existing solutions, orchestrates heterogeneous systems, and provides deep visibility into processes across the organization.