also der folgende Code setzt den Cursor in das richtige Feld; leider kriege ich aber diese "Field Not found " FM nicht weg
Sub Querysave(Source As Notesuidocument, Continue As Variant)
On Error Goto ERRHANDLE
Dim session As New NotesSession
Dim wksp As New notesuiworkspace
Dim db As notesdatabase
Dim uidoc As notesuidocument
Dim doc As NotesDocument
Dim messagestext As String
Dim messagessplit As Variant
Dim messageslist List As String
Dim x As Variant
Dim i As Integer
Dim counter As Integer
Dim message As String
Dim messageintern As String
Dim messagestringsplit As Variant
Dim thisdate As New NotesDateTime("")
Dim ok As Boolean
Dim evalvar As Variant
Dim isnotesuser As Boolean
Dim user As String
Dim item As notesitem
Dim evalstring As String
Dim docunid As String
Dim docmailsend As String
Dim notesitem As NotesItem
Redim ErrorArray(0) As String
Set db = session.CurrentDatabase
' Set uidoc = wksp.CurrentDocument
' if the uidoc is not in editmode set it
%REM
If uidoc.EditMode= False Then
uidoc.EditMode=True
End If
%ENDREM
' refresh the source because if the document was previously not in editmode some fields may not be there
If source.EditMode = True Then
Call source.RefreshHideFormulas
End If
' check for Input Validation
'This line tells the ValidateForm function which field to look at for validation code
ValidationArray = Source.Document.SetValidation
'clear the status bar before you proceed.
Print
If Not ValidateForm(Source.document, ValidationArray, ErrorArray, strGotoField) Then
'If I get here, it means validation failed. So I'll can do whatever. Like make some noise...
'Beep
'...format some text from the ErrorArray for output to a message box...
Msgbox "Es wurden nicht alle erforderlichen Felder ausgefüllt:" & Chr$(10) & l_Join(ErrorArray, Chr$(10)),16,"Unvollständige Daten"
'...and/or put the user cursor in the offending field.
' this does not work the right way. when the user is in another tab error field not found raises
' a description of this can be found here:
'
http://www-10.lotus.com/ldd/nd6forum.nsf/55c38d716d632d9b8525689b005ba1c0/133dabbc5b7b360e85256d580041f15f?OpenDocument&Highlight=0,source.gotof%3Feld,f%3Feld,n%3Ft,found counter = 1
Set uidoc = wksp.CurrentDocument
Set doc = uidoc.Document
WEITER:
Call doc.ReplaceItemValue("$HelpdeskTable", Cstr(counter))
Call uidoc.RefreshHideFormulas
Call Source.GotoField(strGotoField)
continue = False
Exit Sub
Else
'If I get here, I passed validation. You might do nothing at this point. I'll just print a happy message to the status bar.
Call source.refresh
End If
Call thisdate.setnow
' get the actual user
user = session.commonUserName
' build a list for the message strings
messagestext = source.fieldgettext("MESSAGES")
messagessplit = Split(messagestext,";")
For I = 0 To Ubound(messagessplit) Step 1
x = Split(messagessplit(i),"=")
messageslist(x(0)) = x(1)
Next
%REM Removed for configurable Cecking before
' check if the document has a user, problem and at last application entered
If source.Document.user(0) = "" Then
' messageoutbreak
Messagebox messageslist("msgTicketUserNull"), 16, messageslist("msgTicketError")
Continue = False
Exit Sub
End If
If source.Document.problem(0) = "" Then
' messageoutbreak
Messagebox messageslist("msgTicketProbNull"), 16, messageslist("msgTicketError")
Continue = False
Exit Sub
End If
If source.Document.application(0) = "" Then
' messageoutbreak
Messagebox messageslist("msgTicketProdNull"), 16, messageslist("msgTicketError")
Continue = False
Exit Sub
End If
%END REM
' check if there were actions taken if so create some entrys
If source.Document.input(0) <> "" Then
' use the LogActions function for logging entrys.
Ok = logActions(Source,"Useraction","",source.Document.inputtimedate(0), source.Document.inputtimefrom(0),"",source.Document.inputtimeuntil(0),"",Left(source.Document.input(0),100))
If ok = False Then
Print "Error in Module"
continue = False
Exit Sub
End If
' create the action history entries
If ItemTextExists(source.document, "inputhistory") = False Then
source.Document.inputhistory = source.Document.input(0) & Chr(10) & Chr(13) & Chr(10) & Chr(13) & _
source.Document.inputtimedate(0) & "/" & source.Document.inputtimefrom(0) & "-" & source.Document.inputtimeuntil(0) & Chr(10) & Chr(13) &_
user & " " & thisdate.LocalTime & Chr(10) & Chr(13) &_
"________________________________________" & Chr(10) & Chr(13)
Else
source.Document.inputhistory = source.Document.inputhistory(0) & source.Document.input(0) & Chr(10) & Chr(13) & Chr(10) & Chr(13) & _
source.Document.inputtimedate(0) & "/" & source.Document.inputtimefrom(0) & "-" & source.Document.inputtimeuntil(0) & Chr(10) & Chr(13) &_
user & " " & thisdate.LocalTime & Chr(10) & Chr(13) &_
"________________________________________" & Chr(10) & Chr(13)
End If
' empty the action fields
source.Document.input = ""
source.Document.InputTimeDate = ""
source.Document.inputTimeFrom = ""
source.Document.inputtimeUntil = ""
End If
message = messageslist("msgTicketAssigned")
' split this string search the fields and reconnect it
Messagestringsplit = Split(Message,"~~")
Message = ""
For i = 0 To Ubound(Messagestringsplit) Step 1
messageintern = ""
If messagestringsplit(i) <> "" Then
If Left(messagestringsplit(i),1) = "&" Then
' This is a field get the value of that field
messageintern = source.FieldGetText(Right(messagestringsplit(i),Len(messagestringsplit(i))-1))
Else
messageintern = messagestringsplit(i)
End If
End If
Message = Message + messageintern
Next
'set the doc
Set doc = source.Document
' do this only if the document is new
If source.IsNewDoc = True Then
' check if there is a field that steers mail information sending
If itemTextExists(source.Document,"fldMailIfNew") = True Then
Set notesitem = source.Document.GetFirstItem("fldMailIfNew")
docmailsend = notesitem.text
Else
docmailsend = ""
End If
' doc.form = "BugReport"
' check if the user is a notes user because only this ones get documents with links
Evalstring = |@unique(@NameLookup ( [Exhaustive]; "| + Source.Document.user(0) + |" ;"FullName"))|
EvalVar = Evaluate(Evalstring)
If Isempty(EvalVar) Then
isnotesuser = False
Else
isnotesuser = True
End If
' send the mail either as mail with link or as mail
If Ucase(GetConfigDocByKey ("NoNotification")) = "YES" Or docmailsend = "NO" Or (Ucase(GetConfigDocByKey ("MailIfNewDoc")) <> "YES" And docmailsend = "")Then
' do not do anything
Else
If Ucase(GetConfigDocByKey ("MailIfNewDocLink")) = "YES" And isnotesuser= True Then
BoolLink = True
Else
BoolLink = False
End If
' Send Mail
OK = Spoofmessage(_
GetConfigDocByKey("sendMailonBehalfof"),_
doc.user, _
doc.otherusers,_
message,_
messageslist("msgTicketClick"),_
doc,_
"",_
GetConfigDocByKey("MailIfNewDocBodyFieldName"),_
BoolLink,_
True,_
"BugReport",_
"IsNewMail")
End If
End If
' check if there should be a RSS feed. if so create an rfc822 Compliant Date field on that dokument
If GetConfigDocByKey("RSSCreateFeed") = "YES" Then
ok = createRFCDate(doc,"RFC_822_Date")
End If
EXITPOINT:
Exit Sub
ERRHANDLE:
counter = counter +1
Resume WEITER
End Sub