LOTUSSCRIPT /COM/OLE のクラス
例:OnLoad イベント
1. 次の OnLoad イベントは、現在の文書の [CheckedOut] フィールドに「Yes」が含まれているときにメッセージを表示します。
Sub Onload(Source As Notesuidocument)
If (Source.FieldGetText("CheckedOut") = "Yes") Then
Messagebox "This document is checked out",, "Check out"
End If
End Sub
2. 次の OnLoad イベントは、現在の文書が新規文書であれば、[ProblemHistory] フィールドに時刻を書き込みます。
Sub Onload(Source As Notesuidocument)
Dim dateTime As New NotesDateTime("Today")
Call dateTime.SetNow
If Source.IsNewDoc Then
Call Source.FieldSetText _
("ProblemHistory", _
"Problem opened on " & dateTime.LocalTime)
End If
End Sub
3. 次の OnLoad イベントは、編集モードで開いた文書を 3 段階で処理します。
[Owner] フィールドの値が「Employee」のとき、[Request] フィールドに入力された文字列が設定され、[Owner] フィールドは「Manager」に変更されます。
[Owner] フィールドの値が「Manager」のとき、[Status] フィールドは「Approved」または「Rejected」に設定され、[Owner] フィールドは「HR」に変更されます。
[Owner] フィールドの値が「HR」のとき、[Confirm] フィールドは「Approved」または「Rejected」に設定されます。
%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
用語集
フィードバック
ヘルプ
または
プロダクトユーザビリティ
ヘルプの使い方
すべてのヘルプ項目
用語集