Sub Postopen(Source As Notesuidocument)
Dim me_uidoc As notesuidocument
Dim me_founddoccol As notesdocumentcollection
Dim me_founddoc As NotesDocument
Dim me_newdoc As notesdocument
Dim me_founddockey As String
Dim me_rtitem As NotesRichTextItem
Dim me_item As notesitem
Dim me_founddocitem As NotesItem
Dim me_docunid As String
Dim userlanguage As String
Dim OK As Integer
Dim configstring As String
Configstring = GetConfigDocByKey ("WatchFieldHistoryBugMail")
Set g_history = New History
Call g_history.PostopenStartObservation(Source, Split(Configstring,";"))
If source.IsNewDoc = True And source.EditMode= True Then
If GetConfigDocByKey("useMailTemplates") = "YES" Then
Set me_uidoc = source
userlanguage = findcurrentuserlanguage
Call buildlanguagelist(userlanguage,GetLanguageItem(userlanguage,I_CFGSCRIPTMESSAGES))
Set me_founddoccol = me_wksp.PickListCollection(PICKLIST_CUSTOM,False,me_db.server,me_db.Filepath,V_PICKLISTMAILTEMPLATE, _
interactivemessages("plhManualMoveTicketToMailErr001"),interactivemessages("pltManualMoveTicketToMailErr001"))
If Not me_founddoccol Is Nothing Then
If me_founddoccol.Count =1 Then
' save the frintend to get the $ref, Parent and Doclink and some other things
Call me_uidoc.save
' get the document that is open right now into the backend
Set me_doc = me_uidoc.document
' switch to the template with the language the sendto user has (will be build later)
' basedocument selected continue operation
Set me_founddoc = me_founddoccol.GetFirstDocument()
Set me_doc = me_uidoc.document
OK =itemtextexists(me_founddoc, "Subject")
If ok = True Then
me_doc.MailSubject = me_founddoc.Subject(0)
End If
If itemtextexists(me_founddoc, "cfgSendto") = True Or itemtextexists(me_founddoc, "cfgCopyTo") = True Then
If me_founddoc.cfgAddressControl(0) = "0" Then
' replace the found values
Set me_founddocitem = me_Founddoc.GetFirstItem("cfgSendTo")
Call me_doc.ReplaceItemValue("SendTo",me_founddocitem.Values)
Set me_founddocitem = me_Founddoc.GetFirstItem("cfgCopyTo")
Call me_doc.ReplaceItemValue("CopyTo",me_founddocitem.Values)
Elseif me_founddoc.cfgAddressControl(0) = "0" Then
' add the found values
Set me_founddocitem = me_Founddoc.GetFirstItem("cfgSendTo")
Set me_item = me_doc.GetFirstItem("SendTo")
Call me_item.appendtotextlist(me_founddocitem.Values)
Set me_founddocitem = me_Founddoc.GetFirstItem("cfgCopyTo")
Set me_item = me_doc.GetFirstItem(CopyTo)
Call me_item.appendtotextlist(me_founddocitem.Values)
Else
End If
End If
Call me_doc.RemoveItem("MailBody")
Set me_rtitem = me_doc.CreateRichTextItem( "MailBody" )
OK =itemtextexists(me_founddoc, "Body")
If ok = True Then
Set me_item = me_founddoc.GetFirstItem("Body")
If me_item.Type=RICHTEXT Then ' RICHTEXT
Call me_rtitem.AppendRTItem( me_item )
Else
Forall v In me_item.Values
Call me_rtitem.AppendText( v )
Call me_rtitem.addnewline(1)
End Forall
End If
End If
'do the following due to nsd errors in version 6.5.3
Call me_rtitem.Compact
Call me_rtitem.Update
me_doc.form="BUGMAIL"
Call me_doc.Save(True,False)
Set me_doc = Nothing
Set me_newdoc = me_db.GetDocumentByUNID(Source.Document.UniversalID)
Call me_uidoc.Close(True)
me_wksp.EditDocument(False,me_newdoc,,,False).editmode = True
End If
End If
End If
End If
End Sub
Das ist mein Postopen Event...
Wo muss ich das jetzt abändern?