Retrieve and change members of Destination Queues

  • 29 October 2005
  • 9 replies
  • 1 view

Badge +3
I want to get list of users and/or groups that are content of the Destination Queue of the Process.

For example: I have a process, this process has some Destination Queues. One Destination Queue has name "DQ030" and this Destination Queue contain two Active Directory users: "mydomainuser717" and "mydomainuser321". And I need to retrieve this user logins from my code in Server Event.

Then I was little bit surprised that I can't change members of Destination Queue somewhere in K2 Server Management. I can only change this in K2 Studio while designing the Process. Am I right? Is there any possibility how to change members of Destination Queue with the K2 API?

Or, Should I rather use Active Directory groups as members of Destination Queue? But this seems to me like delegating the responsibility of Processes administration to domain administrators and I don't find this as clear solution.

Thanx for all responses in advance.

9 replies

Badge +9
Hi,

Destination Queues needs to be dynamic, AD is the user manager and users moved around between groups must be able to manipulate the outcome of the process. By design it is best to implement Groups and Origination Units in destination queues. K2.net Service Manager does not allow the destination queue to be changes, the only thing you can do is to set the refresh interval on the queues, or force a refresh.
Badge +3
Hi.

Thanx for your reply. I consider to have groups in destination queues.

But, can I retrieve Active Directory Group's Name through the K2 API, if this Group is part of the Destination Queue?

For example: I have Destination Queue named "myDQ" and this one in Send To contains AD Group named "myADgroup". Hi can I get through API the "myADgroup" name of the group if I know that Destination Queue's name is "myDQ"?

Thanx in advance, that will help me a lot.
Badge +11
Through the K2Mng object model, you can retrieve the 'Data' property of a Destination Queue which contains the full XML value of the Destination Queue exported to K2.net Server. In this XML field, you'll be able to see the name of the Active Directory Group.

Hope this helps,
Ockert
Badge +3
Hi.

Thats'it. Data property of DestQueue has the right data I need. Using XPath I can get what I need.

I don't know why, but I didn't notice "SourceCode.K2Mng namespace" topic in my K2 Help...

Thank you.
Badge +11
Thank you for the feedback.

If I remember correctly, the K2MNG object model was only documented in the Help file from K2.net 2003 SP2 onwards. If you haven't got it in you Help file, you're probably running on an older version of K2.net 2003.

Regards,
Ockert
Badge +3
Hi.

I have the latest version and I also have this part of help. But, I haven't noticed that I have it - it was my mistake...

Actually I found out another problem but this was easy to solve. When I try to connect to K2 server (using Login method of K2Manager class) without specifying connection string, it fails with following error message:

The User : 'MYDOMAINMYSERVER$' does not have the necessary rights to perform this action, please contact your System Administrator

MYSERVER is my K2 server's name. When I try to find something called "MYSERVER$" in Active Directory through the K2 Server Manager nothing is found.

So, only solution I found to allow this "account-or-what-it-is" login to K2 is to add a record to _ServerUser table in K2 database. It's not so clear, but it works fine.
Badge +11
Would you like me to explain in detail why this is the case? If so, are you building a web app or a windows app?

Regards,
Ockert
Badge +3
Hi.

This problem occurs when I try to login to K2 from Server Event.

I have an activity with 3 destinations and also 3 slots. These destinations are destination queue (each DQ contains one and only one user). Destination queue stands here like some kind of "role" so I can change the member of DQ and it changes everywhere in the process.

First activity of this event is client activity, where users can "approve" or "decline" something - the result of this is saved in an activity data field (easy to create a one single ASP.Net page that is same for all 3 users so users decision doesn't overwrite previous user decision because of the fact, that data are written to activity instance).

After this client event completes, next steps are two server events.

In first server event (which in fact runs for every activity as many times as there are activity slots) I find out the login of user which really done this activity instance (K2.ActivityInstanceDestination.User.Name) and this I need to compare to user which is in some destination queue. Depending on the destination queue activity data are re-saved to correct process data fields (one field for approval status, other for approval user - both fields are 3 times in process - one pair for each destination user).

Finally, I have another server event, where I look into these three process data fields and I'm checking here, if the process is approved or not. Also I'm doing here a decision where should the process move. So, if I will not re-save activity data to process data in previous server event I will have no chance to access all activities data in this server event.

That's it. I spent a lot of time to find some solution, because there is in fact a lot of problems not only this one I mentioned. I found out this one solution and it just works fine.

But, if you have any good idea that should fix my problem you can post it here. What I think is that it'll need some longer discussion and maybe finally you will find out, that my solution is at least best (quicker one) if not the only one for our strange processes.
Badge +11
Interesting...

I agree, a typical problem for our consultants which will definitely need a longer discussion and understanding of the requirement.

Please do not hesitate to contact your local K2Workflow Services consultants should you need further help/clarification.

Regards,
Ockert

Reply