This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Delete PersonInOrg within DialogMethod

Version 7.1.3

I want a DialogMethod to delete PersonInOrg with xOrigin=1.

The method currently looks like this:

-------------------------------------------

'Baut Org Direktzuweisungen ab, welche bereits durch ESets übernommen wurden
Try
 If Not Entity.IsLoaded Then
  MsgBox (#LD("Not possible in insert mode.")#, MsgBoxStyle.OKOnly Or MsgBoxStyle.Information, "Information")
 Else 
  
  If MsgBox("Sollen die selektierten Direktzuweisungen für PersonInOrg abgebaut werden?", MsgBoxStyle.YesNo,#LD("CAUTION")#) <> MsgBoxResult.Yes Then
   Return
  End If


  Dim frmVerarbeitung As New FormProcessingOrgToEset
  frmVerarbeitung.show()

  If TypeOf Entity Is MultiSelectEntity Then
   Dim msobj As MultiSelectEntity = CType(Entity, MultiSelectEntity)
   For Each obj In msobj
    frmVerarbeitung.updateStatusMsg("Baue Direktzuweisung " & obj.GetValue("XObjectKey").String &" ab: "  ) 
    obj.DeepDelete(Session).Execute(Session)
   Next
  Else 
   frmVerarbeitung.updateStatusMsg("Baue Direktzuweisung " & Entity.GetValue("XObjectKey").String &" ab: "  ) 
   Entity.DeepDelete(Session).Execute(Session) ' <--- The Failing case
  End If
  frmVerarbeitung.setFinished()

 End If
 
Catch ex As Exception
 Throw New ViException("Unbekannter Fehler auftreten", ExceptionRelevance.EndUser, ex)
End Try

-------------------------------------------

The part with the MuliSelectEntity works fine so far.
There is a problem with the ELSE case for the Single Objects.

I get the error message: "[810299] The object was already saved. Reload it to do any further changes."

I tried with reload the entry, but I don't get it working.

How do I have to solve this problem?

Parents Reply Children