Skip to main content

I'm working on a custom web application that is using the K2 Workflow engine behind the scenes to drive the various steps, notifications, and escalations associated with a process in that application.  The issue I am encountering is with setting the various activities' destination sets.  What I am looking to do is set the destination set for an activity and it's client event based on a SQL query that given two parameters returns a list of active directory users.


Currently, I am doing this with a SmartObject method to populate the destination set.  The activity is passing the two parameters to the SO method which is in turn making a call to a customer Service Broker/Service Object and passing those parameters.  The Service Broker/Object is then connecting to the SQL database, performing the SQL query and then returning the results of the query.


Right now, if there is only one result and I return it as a string, the K2 Activity understands the result and assigns the activity / client even to that result.  The problem is when there are more than one result.  I cannot figure out what format the K2 Activity is expecting to be able to set a Destination Set given multiple active driectory accounts.  I have tried returning a list of strings, an array of strings, and various delimited strings (using commas, semi-colons, etc.)


Has anyone tried to do this and how did you do it?


I have spoken with K2 and they suggested using an XML data field with a repeating node and I have done this with limited success.  The problem I am seeing with it is that an activity with a SmartObject event to populate the XML data field must be set up prior to each activity that uses the data field.  That isn't really a huge problem, but it seems "hacky", adds a lot of steps to the workflow, and will result in a workflow that doesn't look "pretty" (and our business users want to be able to see the workflow).  The limited success portion that we have had is that, once again, if I am returning only one result, I can populate the repeating node of the XML data field.  However, if I return more than one result, I am not sure how to populate the XML field.


Any help / advice appreciated.


Charles

I would recommend you take K2's suggestion, but put it into another process that you get to via IPC.  That would hide it from the users, all they would see is a 'get destination users' event, and it would be reuseable if you needed to invoke it for other activities.  Does that make any sense?


In addition to the approach of using XML field value with repeating nodes, please try another approach of calling SmartObject's GetList() method and it worked for me.   


The smart object, for example, Employee, has a GetList service method that returns list of user IDs, usernames etc.


Configure the destination set of a destination rule and add Employee.GetList.UserID wity type User.


If you already have a smart object in place that you can call for a list of users, this might be a good option for you.


I'd like to reiterate Frank's suggest of a SmartObject GetList().  There is no special delimited string format that instructs K2 to parse that value of a single string for multiple destination users.  K2 understands multiple destination users are expected when a GetList or a repeating section of an XML field is used. 


A couple of more things:


- I don't think you can have anything else in that specific destination field.  In the attached screenshot you'll see where I manually typed in a user and have a GetList on the same field.  K2 will not like this.  If you need to do something like this, break it up across multiple rows in the Destination.


- The field pointed to by the GetList return value (in my example, "Departments.Get_List.Manager") must be in a user ID format that K2 understands (for example DomainUserName).


HTH.


15646iDBD9CC4785704A2F.jpg

I tried your Solution (SmartObject Get List on Destination Rule to assign Multiple Users), I got the following Error


28006 Datafield Action Result not found


Please advise me if you know why i am getting this error.


When are you receiving this error; at build time or run time? 

At first glance this error doesn't look like it should have anything to do with a Destination Rule; perhaps a line rule?


I am getting this error at Run Time. I did not set anything in Line Rule.

Reply