If the Owner field contains "HR," the event gets the value "Approved"
or "Rejected" in the Confirm field.%INCLUDE "lsconst.lss"
Sub Onload(Source As Notesuidocument)
Dim ownerType As String
Dim employeeRequest As String
If Source.EditMode Then
ownerType = Source.FieldGetText("Owner")
Select Case ownerType
Case "Employee"
employeeRequest = Inputbox$ _
("Enter your request", "Request")
Call Source.FieldSetText("Request", employeeRequest)
Call Source.FieldSetText("Owner", "Manager")
Case "Manager"
If Messagebox _
("Do you approve this request?", _
MB_YESNO, "Approve") = IDYES Then
Call Source.FieldSetText ("Status", "Approved")
Else
Call Source.FieldSetText("Status", "Rejected")
End If
Call Source.FieldSetText("Owner", "HR")
Case "HR"
If Messagebox _
("Do you confirm this decision?", _
MB_YESNO, "Confirm") = IDYES Then
Call Source.FieldSetText("Confirm", "Approved")
Else
Call Source.FieldSetText("Confirm", "Rejected")
End If
End Select
Call Source.Save
Call Source.Close
End If
End Sub