SharePoint 2010 workflow task stuck "In Progress"

Frank Martin 476 Reputation points
2024-07-12T05:57:18.67+00:00

I am using SharePoint 2010 designer workflow in 2016 on premise. Once a task is assigned to user, its status is set to Not Started. Once user completes the task then task status is changed to Completed.

If I update task item directly using PowerShell for e.g. changing user to whom task is assigned, then the task status is changed to In Progress and it remains like this and doesn't move forward. Then I have to end the workflow.

How can I update task list item directly using PowerShell and still keep status as Not Started?

The same behaviour also happens if the user who is completing task is not the one to whom task is assigned. In that case too, task status will change to In Progress instead of Completed

SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
10,783 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.
598 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

  2. Ling Zhou_MSFT 18,020 Reputation points Microsoft Vendor
    2024-07-12T08:57:58.61+00:00

    Hi @Frank Martin,

    To update a SharePoint 2010 workflow task list item directly using PowerShell and keep the status as "Not Started", you can use the following PowerShell script:

    # Replace the values in angle brackets with your own values
    $webUrl = "<URL of the SharePoint site>"
    $listName = "<Name of the task list>"
    $itemId = <ID of the task item to update>
    $newAssignee = "<Login name of the new task assignee>"
    # Get the SharePoint web and task list
    $web = Get-SPWeb $webUrl
    $list = $web.Lists[$listName]
    # Get the task item and update its Assigned To field
    $item = $list.GetItemById($itemId)
    $item["Assigned To"] = $newAssignee
    $item["Status"] = "Not Started"
    $item.Update()
    

    This script gets the SharePoint web and task list, then retrieves the task item by its ID and updates its Assigned to and Status fields. By setting the Status field to "Not Started", the task will not be marked as "In Progress" and should move forward as expected.


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.