Delete PersonInOrg Object (all Direct assignments) via Script ?

HI,

I am using Version 8.1 and trying to delete the assignments from PersonInOrg table via a Script.

I have written below script to test the method calls.

Already tried

  • Running from designer (test script option).
  • Also, tried putting script in a process and calling the Process chain from a custom event.

Both results ion same error saying as  - "[810222] Error executing script 'test_Deletion_PersonInORg'.
[System.NotSupportedException] Specified method is not supported."

PLease help with the sample script and right method to call for deleting entries in PersonInOrg table.

Script and method I used are as below :



End Sub

Public Sub test_Deletion_PersonInORg(ByVal strUID As String) 

Connection.BeginTransaction()

Dim strWherePersonInOrg As String= " UID_Org= '8faf76dd-a704-4dfc-862d-5cabae489329' and uid_person='5b8d9c93-aae1-4d9e-b2a2-c79819d1dfe9' "
Dim qPersonInOrgUIDs As Query = Query.From("PersonInOrg").Where(strWherePersonInOrg).Select("UID_Person","XObjectKey","UID_Org","XOrigin")							
Dim cPersonInOrgUIDs As IEntityCollection = Session.Source.GetCollection(qPersonInOrgUIDs)
		 For Each ePersonInOrgUID As IEntity In cPersonInOrgUIDs						
			Dim strUidPerson As String = ePersonInOrgUID.GetValue("UID_Person")
			Dim strXObjKey As String = ePersonInOrgUID.GetValue("XObjectKey")
			Dim strXOrigin As String = ePersonInOrgUID.GetValue("XOrigin").String

			ePersonInOrgUID.MarkForDeletion()
			ePersonInOrgUID.Save(Session)		
			
	     Next
Connection.CommitTransaction()	
	
End Sub