I need to "enhance" the evaluation method used in setting the end result of a field. The following script evaluates the rich text field to determine if there is an attachment (see below). If there is an attachment, the status is changed to Status = "6 - Appraisal Completed" (and Statusflag5 = "1"); if the attachment is not found the Status = "5 - Management Review" (and Statusflag5 = "0").
I need to keep the functionality already in place, plus add the following evaluation:
If field "Level" equals "Review" change Status to "5 - Management Review)(and Statusflag5 = "0").
This step needs to be added to the current evaluation process that's already in the script. (After the field "Level"is evaluated, the attachment field needs to be evaluated (same as current).
Function ValidateAppraisal_Report (Field As String) As Variant
'Validation to find if there is atleast one attachment in this document
Dim ws As New NotesUIWorkspace
Dim uidoc As NotesUIDOcument
Dim note As NotesDocument
Dim rt As NotesRichTextItem
Set uidoc = ws.CurrentDocument
Set note = uidoc.Document
AttachmentFound = False
Set rt = note.GetFirstItem( Field )
' Check for attachments in the richtext item
emobjs = rt.EmbeddedObjects
If Isarray(emobjs) Then
Forall emobj In emobjs
If (emobj.Type=EMBED_ATTACHMENT) Then
AttachmentFound = True
' Set the flags
If AttachmentFound Then
note.Status = "6 - Appraisal Completed"
note.Statusflag5 = "1"
note.Status = "5 - Management Review"
note.Statusflag5 = "0"
Print "Attacment Found: " & AttachmentFound
ValidateAppraisal_Report = AttachmentFound