cancel
Showing results for 
Search instead for 
Did you mean: 

How to programmatically assign an Administrator to a process?

Qualiture
Active Contributor
0 Kudos

Hi,

With the latest BPM API, it is now possible to programmatically cancel a process. This cancelling can either be done by a BPM SuperAdmin, or by a user who is part of the assigned Administrators of that particular process.

Since we only want certain users to cancel a process, but not giving them BPM SuperAdmin rights, I need to suspend the given process, assign that user as an administrator, and then I'm able to have them cancel that process.

I have the following code:


ProcessInstanceManager pim =  BPMFactory.getProcessInstanceManager();

URI processUri = new URI(BPM_PROCESS_URI + processId);

pim.suspend(processUri);

// here I should assign the current user as an administrator to the process, but how??

pim.cancel(processUri);

As you can see from the code, I'm missing the part assigning the currently logged in user as an administrator to the process instance. I've searched the BPEM API back to front, but could not find a method or operation to do so.

As a workaround, a BPM administrator now goes into NWA, assign that user as an administrator to the process, and then the user can cancel their process, but this is far from ideal.

Does anyone know of a programmatically suitable solution?

Thanks in advance!

Robin

Accepted Solutions (1)

Accepted Solutions (1)

former_member191044
Active Contributor
0 Kudos

Hi Robin,

why don't you assigne Administrators to the Pool in the BPM Designe Time? You can assigne a role / group or determine user dynamically by using functions.

Regards,

Tobias

Qualiture
Active Contributor
0 Kudos

Hi Tobias,

Yes that would work as well, but unfortunately not for current processes. But for future processes this is certainly a viable option

former_member191044
Active Contributor
0 Kudos

Looks like there is no way to set it via API. As workarround you could publish your operation to cancel processes as webservice and configure your service to be called by a technical user with BPM admin permissions. So you could consume this service in an application and every user would be allowed to cancel.

Regards,

Tobias

Qualiture
Active Contributor
0 Kudos

That's what we have right now for the newer processes. But we also have many processes which run for years since they started which do not have this paradigm, so I was hoping the new BPM API 'cancel' method could be of help here.

Alternatively, do you know it it is then possible to retrieve (get instead of set) the assigned administrator(s)?

former_member191044
Active Contributor
0 Kudos

As far as I know there is no way to get administrators by API.

What do you mean with "which do not have this paradigm"? Basically the cancel operation should work on the older processes too. So your problem is that only BPM Super Admins or defined administrators are able to cancel? Or did I get it wrong?

My approach was to develop a own litte application which cosumes a web service that is run as a technical user that has Admin permissions. So you would not need to assigne BPM Admin to all users and they could run the cancel operation in name of that technical user. I think that could work.

Regards,

Tobias

Qualiture
Active Contributor
0 Kudos

Ah ok, now I understand I thought you meant updating the process so it could listen to a 'cancel' message and invoke that via a webservice. However, your approach seems to be way more versatile!

Thanks!

Answers (0)