Dynamic user assignment in workflow

  • 22 January 2009
  • 3 replies
  • 0 views

Badge

Hi,


I am trying to design a workflow where the owner of (say)first activity will decide the owner of the second activity in the workflow. When the owner of the first activity completes his task, a dropdown with the list of users should be shown on the Sharepoint site, where the owner for the second activity can be selected.


Can this be done by creating a smart object and populating it with users and then retrieving the list of users in the destination rule of the second activity?If yes, how do I go about populating the smart object with values?


Kindly suggest on what can be done.   Thanks in advance.


 


Rekha


 


3 replies

Badge +9

Part of completing the first task will be to select the destination user for the next task, this would have to be done before the task can be submitted (you'd need an InfoPath or ASP interface for this).  Create a smart object to store the selected destination user with some Id unique to this instance of the task, and then load up that smart object in the destination rule for the next task and it will be assigned to the destination user that it loads up.


I am probably over-simplifying the solution here, I'll help if you need more detail.  If you can't use InfoPath or ASP to capture this data, though, it becomes a bit more difficult.

Badge +3

I've had the same requirements with a workflow I am just in the process of completing.  I have used a simple SharePoint List as the User Interface to select the user of the next task.  SharePoint does this inherently, so selecting user is not an issue.  I then use the K2 SmartObject API to upload the value in to a SmartBox table.


In the code behind my destination rule, I overwrite the AddUsers method with a lookup to the SmartObject table value.


To get the values out of sharepoint I use the SharePoint Lists web service.  To assign the value to the smartobject I use a Server Event, and I have a business layer (class library) that I call that references the SharePoint web service and does all the grunt work. 


Only issue with my solution is where to put the configuration code to the web service.  Currently I do this in a custom configuration file in the Host Server bin directory, and I point the K2HostServer.config appsettings to that custom config file.  Not ideal, but in this way, all my K2 processes can use the SharePoint web service.


What you need is to store the List Item Id, this shouldn't be an issue if you are also creating the SharePoint List Item (again, using the SharePoint web service to create an item). 

Badge +9
That is an interesting idea that I never thought of, thank you for sharing!  Though I don't think you need to overwrite the destination rule code behind, you can probably get the users from your SmartObject using the destination rule wizard (a little easier to maintain).  You could even wrap your SharePoint list in a SmartObject, getting rid of the need for some of the extra complexity around getting to the SharePoint web service (I think)

Reply