'**********************************************************
' deleteAttachments
' @description: deletes all attachments with the column "sDeleted" = "Ja / Yes"
' @param: nothing
' @return: nothing
'**********************************************************
Function deleteAttachments
	Dim sToDelete : sToDelete = ""
	Dim i
	For i=0 To wfvariables.recAttachments.Count - 1 
		If wfvariables.recAttachments.Item(i).Item("sDeleted").Value = "Ja / Yes" Then
			iObjectID = CLng( wfvariables.recAttachments.Item(i).Item("sObjectID").Value )
			'deleteDocument iObjectID, wfvariables.recStructure.sAttachmentInternalName.Value
			deleteObjectInWFFile iObjectID, wfvariables.recStructure.sAttachmentInternalName.Value	
			'CC-000948 - removed the bPersisted check, because it is not used anymore		
			If sToDelete <> "" Then
				sToDelete = sToDelete & "|"
			End If
			sToDelete = sToDelete & wfvariables.recAttachments.Item(i).ListItemId
		End If
	Next
	If sToDelete <> "" Then
		Dim aToDelete : aToDelete = Split( sToDelete, "|" )
		For i=0 To UBound( aToDelete )
			wfvariables.recAttachments.RemoveListItem aToDelete( i )
		Next
	End If
End Function