Release/Redirect via SmartObject

  • 19 March 2019
  • 6 replies
  • 73 views

Userlevel 5
Badge +13

I'm trying to create a SmartObject that will allow users to Release/Redirect their tasks from a custom dashboard. In the past, I would write a custom WCF service to handle this and wrap it in a SmartObject - I'm trying to avoid this by using some of the more out-of-box services instead.

 

Using the "Task" SmartObject that exists under "SystemManagementUsersSmartObjects" requires that the current user be a Server Admin to release their tasks, so that is out of the question.

 

Using the WCF services endpoint, the "Release" and "Redirect" functions there seem to try to open the work item before releasing it, and even though it is running under the context of the K2 service account it is unable to do so. I was hoping these would just administratively release the task (much like the K2 Management site does).

 

So the question is if there is any out of the box hook that can be used to allow regular system users to release and/or redirect tasks without having to roll my own service to do so?


6 replies

Hello,


 


I think our best bet is to utilize the Workflow REST API and create a SmartObject from the REST broker to do this. THis way we can use the Service Account's credentials to run this and don't need to provide any additional permissions to users. 

Userlevel 5
Badge +13

Thank you, I  had made an attempt to do this but was unclear what values to use in the REST broker to configure the out-of-box REST API. Is there any documentation with guidance on this?

Hi  @tbyrne777

 Please find below link for Workflow REST API documentation

https://help.k2.com/onlinehelp/k2five/userguide/5.0/default.htm#K2_Management_Site/Integration/Workflow-REST-API.htm

 

I have executed this using postman 

Redirect 

 

URL : http://bpmdev.com/Api/Workflow/V1/tasks/SN/actions/redirect 

Body :  {
"RedirectTo":"UserName"

 

Release

 URL: http://bpmdev.com/Api/Workflow/V1/tasks/SN/actions/release

 

Hope this will help you.

 

Userlevel 5
Badge +13

Thanks, I was able to get that far but I was hoping to create a SmartObject that binds to the Workflow REST Api... I couldn't figure out how to register it as a service instance

Hi  @tbyrne777;

 

The following links should help by now https://www.youtube.com/watch?v=MHoFd_MsQLI

https://help.k2.com/onlinehelp/k2five/userguide/5.2/Content/ServiceBrokers/EndPoints/REST_Endpoint.htm

 

Thank you.

 

regards;

widson.

Hi!

This would really help solving a problem in daily application management! I want to offer the process owners the possibility to release a task from their process forms. 

 

I enabled the REST API (currently running on 5.1) and also created a service instance / SMO based on the REST service type linking to it. I used the service account as static credentials in the service instance. When I execute the ReleaseTask method with a serial number it doesn't find it. The task is currently opened by my regular user account. When I configure the service instance to use my regular user account I can use the SMO to release the task. The service account has admin permissions on this workflow. It works for the user who has currently open it. Any ideas or suggenstions?

 

Many thanks!

Joachim

Reply