To terminate an object or relationship, use the CreateDeleteInstruction method on the SPF.Client.Schema.Utilities class or a method on the ContainerObjectDictionary.
Public Shared Function CreateDeleteInstruction(ByVal pobjSPFSession As SPFSession, ByVal pstrUID As String, ByVal pstrDeleteTransition As String) As IObject
The DeleteTransition is basically a switch to indicate whether the object should be deleted or terminated. Use the values "Deleted" or "Terminated."
The second overload adds a RefClass parameter. This is normally used when deleting/terminating relationships the RefClass needs to be set to "Rel."
Public Shared Function CreateDeleteInstruction(ByVal pobjSPFSession As SPFSession, ByVal pstrUID As String, ByVal pstrDeleteTransition As String, ByVal pstrRefClass As String) As IObject
Notice that both of the methods return the DeleteInstruction as an IObject. To terminate the instrument from the previous example, the code would be this:
' Begin transaction
Dim lcolTransaction As New ObjectDictionary(Me.SPFSession)
' Find an instrument
Dim lobjInstr As IObject = Me.SPFSession.GetObjectByName("CV-101", "IProcessInstrument")
' Create a delete instruction for this instrument
Dim lobjDeleteInstruction As IObject = SPF.Client.Schema.Utilities.CreateDeleteInstruction(Me.SPFSession, lobjInstr.UID, "Terminated")
' Add the delete instruction to the transaction
lcolTransaction.Add(lobjDeleteInstruction)
' Commit transaction
lcolTransaction.Commit()
Relationships can be terminated or deleted in the exact same way.