Workflow not moving to next stage when task is assigned to a group

Frank Martin 431 Reputation points
2022-01-29T12:35:18.377+00:00

I have created SharePoint 2013 style workflow in SharePoint 2016. Problem is when I assign a task to a SharePoint group then it doesn't move to next stage when user approves it. There seems to be no error and the Outcome changes to "Approved" and workflow status remains "Started" and it is not terminated or stopped.
If I assign task to a user then upon approval workflow moves to next stage. No issues here.

Here is workflow screenshot. Notice that the task was assigned to group "HR Business" and the outcome is approved i.e. task has been approved but still it has not moved to next stage which is "Head of HR". Also in the screenshot you can see that workflow internal status is "Starting" which is means it is still running.

169583-workflow1.jpg

Here is screenshot of workflow from SPD. It's a simple workflow i.e. if task is approved then move to "Pending with Head of HR" stage.

169592-workflow2.jpg

Here's my code which approves the task. I am using custom form and task is approved via C# code.

var taskItem = SPContext.Current.ListItem;  
taskItem["PercentComplete"] = "1";  
taskItem["Status"] = "Completed";  
taskItem["TaskOutcome"] = "Approved";  
taskItem.Update();  
SharePoint Server
SharePoint Server
A family of Microsoft on-premises document management and storage systems.
2,221 questions
SharePoint Development
SharePoint Development
SharePoint: A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.Development: The process of researching, productizing, and refining new or existing technologies.
2,668 questions
SharePoint Workflow
SharePoint Workflow
SharePoint: A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.Workflow: An orchestrated and repeatable pattern of business activity, enabling data transformation, service provision, and information retrieval.
508 questions
SharePoint Server Development
SharePoint Server Development
SharePoint Server: A family of Microsoft on-premises document management and storage systems.Development: The process of researching, productizing, and refining new or existing technologies.
1,573 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Frank Martin 431 Reputation points
    2022-01-29T15:39:26.93+00:00

    Ok I just noticed that when task is assigned to a group then it displays a small "i" icon besides workflow's internal status (as shown in first screenshot above) and clicking on that icon displays this message:

    Retrying last request. Next attempt scheduled in less than one minute. Details of last request: HTTP Unauthorized to https://mysharepoint/sites/mysite/_api/sp.utilities.utility.SendEmail Correlation Id: b9a1cab8-319e-09da-a6a2-fa30cc3756cf Instance Id: 775169b4-362c-44e8-bc8c-b893474fde7a 
    
    Access denied. You do not have permission to perform this action or access this resource. 
    

    This seems like email sending issue (I have confirmed that email is not being sent probably due to SMTP issue) but this shouldn't affect the workflow right!? I mean task should still be approved/rejected?

    0 comments No comments

  2. Frank Martin 431 Reputation points
    2022-01-29T15:44:54.63+00:00

    Ok I found out that email problem was indeed causing the issue. It had nothing to do with SMTP but because my group's membership view setting was set to "Members Only" hence the error and workflow was not moving to next stage.
    I simply set my group's view membership to "Everyone" as mentioned on following page and now workflow is working fine.

    https://learn.microsoft.com/en-us/sharepoint/troubleshoot/sharing-and-permissions/access-denied-when-send-an-email-to-groups