none
Workflow to Group

    Question

  • We have a custom workflow built in Visual Studio.

    The list of members who are assigned tasks are stored in a SharePoint list (a look up list so to speak)

    Example:

    Accounting         SomePerson

    Management      SomePerson

    I have made the list so that 'SomePerson' can now be a SharePoint Group and all the settings on the list itself is set up correctly for that.

    However, now when the workflow creates a task if the assigned to is a Group it gets created as a blank.

    The task list also accepts Groups for the Assigned to Column.

    Any ideas?

    Thursday, December 12, 2013 3:33 PM

Answers

  • Hello,

    How you are assigning group in assign to field?If i understood you correctly, you are putting group name in someperson. If this is the case then first get the group name from list then use SPGroup to validate it. Try below sample code to assign task to group

    SPGroup group = workflowProperties.Web.Groups["Group Name"];
    SPFieldUserValue groupValue = new SPFieldUserValue(workflowProperties.Web, group.ID, group.Name);
    SPWorkflowTaskProperties taskProperties = new SPWorkflowTaskProperties();
    taskProperties.AssignedTo = groupValue.LookupValue;
    Hope it could help


    Hemendra:Yesterday is just a memory,Tomorrow we may never see
    Please remember to mark the replies as answers if they help and unmark them if they provide no help

    Friday, December 13, 2013 6:43 AM

All replies

  • It appears the workflow is pulling a user login name which clearly a SharePoint group is not going to have

    Thursday, December 12, 2013 3:45 PM
  • Hello,

    How you are assigning group in assign to field?If i understood you correctly, you are putting group name in someperson. If this is the case then first get the group name from list then use SPGroup to validate it. Try below sample code to assign task to group

    SPGroup group = workflowProperties.Web.Groups["Group Name"];
    SPFieldUserValue groupValue = new SPFieldUserValue(workflowProperties.Web, group.ID, group.Name);
    SPWorkflowTaskProperties taskProperties = new SPWorkflowTaskProperties();
    taskProperties.AssignedTo = groupValue.LookupValue;
    Hope it could help


    Hemendra:Yesterday is just a memory,Tomorrow we may never see
    Please remember to mark the replies as answers if they help and unmark them if they provide no help

    Friday, December 13, 2013 6:43 AM