Assign task to user from sharepoint user and group field

  • 4 August 2009
  • 7 replies
  • 6 views

Badge +2

Hi,

I have a sharepoint list with a field - Approver, which is standard user and group field - configured to chose only users. I am building K2 workflow using event template. I want to create a task assigned to user chosen during item creation.

What are known aproaches to acomplish this. Any out-of-the-box no-code options? Does K2/Moss integration go that far to recognise this field as a valid user?  I am aware of user and group field structure, that it is in format ID;#username.

Can someone explain how to make a use of smartobjects in this scenario?

Any help really appreciated, this is my first K2/moss project.

Thanks

Anna

 

 

 


7 replies

Badge +5

Hi,


this is doable easily with blackpearl smartobjects, here are the steps:



  • in the workspace, browse to management console, smart objects and service objects.
  • click SharePoint service and create a new instance pointing to your sharepoint site and list
  • create a smart object project in vs.net
  • in the smart object methods, add a new method that points to the sharepoint service instance you created earlier.
  • make sure to create the required smartobject properties that correctly mapped to the service instance parameters.
  • now you have a smart object that can be consumed in wherever you want, destinations rule, line rules....

hope this helps :)

Badge +2

Thanks a lot for your help, with your steps I created my smartobject easy! :)

I have a concern about multi users field - I have a field: Approvers - this is person and group field - let's say I choose two people.

When I set my event destination to this field - it set only one task to first user in this field. Probably even worst scenario would be: one user, one AD group - it can happen in "people and group field". How should I handle this type of situations?

 

Thanks

Anna

 

 

Badge +5

I assume you are using InfoPath, this is easy :)


incorporate the smart object with your infopath form, bind a drop down list in a repeating table to the smart object data source and publish the form.


when configuring the destinations in the process and once you assign the destination to a repeating node in your infopath schema, K2 process is intellegent enough to determine that there is more than one user to be assigned the task and hence it assigns them.


see attached screen shots .... hope this helps ...


Yousef


 

Badge +2

Hi Yousef,

I am using ASP.NET form and I have entity pickers there as I have to keep sharepoint user experience and be able to choose from Active Directory, not from limited dropdown list.

Your solution looks very neat but unfortunately not my case :)

Thanks anyway.

 

 

 

 

Badge +10

Hi Anna,


I believe this is still possible. Since you have the SmartObject already, you will simply need to assign the destinations by calling a GetList on the SmartObject. It will then create the necessary destinations.


Example:


SmartObject (SmO) Properties: RequestID, User


A new SmO record is created for each user that needs to be an approver. For each request the RequestID for all the users will be the same. If I need to get all the approvers for a specific RequestID then I will pass the common RequestID in as a parameter to the SmO's GetList method. It will then return the users that will act as approvers. In the destination rule you will use the GetList.User field. This will ask you for a filter and then you assign the RequestID as the filter.


You might need to use an advanced destination rule to create a slot for each destination user if you require an action from each user.


Hope this helps!


 

Badge +2

Hi Johan,

I tried this approach but I am getting one task for first user only. I have setting: "Create a slot for each destination".

What should I choose as a type of a smartobject destination - should I leave "User" or change to group/role ?

 Any other settings I am missing?

 

 

 

Badge +10

Hi Anna,


The setup as you described it should work. Can you perhaps try with different users in your SmartObject? It might be that K2 Server could not resolve the second user for some reason.


You should leave the destination on the "User" type for this scenario.


If the above still does not work, try changing the Planning type to Plan per destination > All at once. I doubt that it will make a difference, but is worth a try.


As a workaround you can always create a role that looks at your SmartObject (using Workspace Management Console) and assign this role to the destination.


Regards,

Reply