I am managing the whole CRM process flow in C# code, using the newest SDK version (8.2). Moving forward works fine, simply by updating the stageid on the relevant entity. However I have no idea, how could I finish the last stage = how could I set process to finished. I'd like to call exactly the same actions as with clicking the button "set finished"

To set the current status of the active process instance to finished use:
Xrm.Page.data.process.setStatus("finished");
From the Microsoft documentation:
Xrm.Page.data.process.setStatus(status, callbackFunction);
status is a string that can be active, abandoned or finish. callbackFunction is an optional function to call when the operation is complete.
Note: though the documentation says to use finish this does not work: use finished.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With