Change State of record using Plugin in Dynamics 365 CE

To Change record status of dynamics 365 records use below code. Update your code accordingly to suit your business need. Hope this helps.