When you create a business process flow you create a custom entity. For example, if you create a business process flow called
Marketing Management in the default solution, you will create an entity called
new_marketingmanagement.
When you activate a business process flow on a record, an instance of that entity is created. The instance holds information such as which stage the process is at and when the process was started.
You can deactivate the instance using
Microsoft.Xrm.Sdk.Messages.SetStateRequest:
Where
processFlowName is the logical name of your business process flow as a string and
processId is the ID of the process flow instance you want to deactivate as a GUID.
To find the ID of your process flow instance, you can query the attribute _bpf_primary_key_value where primary_key should be replaced with the primary key of the entity which your process is on. For example on the Account entity this would read _bpf_accountid_value.