How to update the field of Internal Status or UserStatus of SharePoint 2013 workflow instance?

teik boon teh 191 Reputation points
2021-07-01T10:27:12.217+00:00

Hi all, I'm using SP workflow 2013 for my provider hosted solution in SharePoint online. The workflow I used is 2013 version and I use CSOM to interact with the workflow. I want to create a button which will terminate the workflow when it is clicked which I managed to do so but I can't update the field of Internal Status or .UserStatus where you can see it from API of WorkflowInstance.

I tried with the sample code below but seems it doesn't working for my case. Anything I missed out?

targetInstance.UserStatus = "Cancelled by Requestor";
appClientContext.ExecuteQuery();

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.
3,031 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.
599 questions
0 comments No comments
{count} votes

Accepted answer
  1. teik boon teh 191 Reputation points
    2021-07-10T09:44:19.96+00:00

    Hi Michael, I can't find a way to update the field of UserStatus so I went for another way which is to display alternative status name when another field in workflow called Status is Terminated. The field of Status can be updated when the workflow instance is terminated or stopped.


1 additional answer

Sort by: Most helpful
  1. MichaelHan-MSFT 18,036 Reputation points
    2021-07-02T07:55:13.05+00:00

    Hi @teik boon teh ,

    Per my test, I got the same result as yours on my end.

    Looks like the UserStatus property of WorkflowInstance can not be changed with CSOM.

    If an Answer is helpful, please click "Accept Answer" and upvote it.
    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.