Duration
3 days
Overview
LotusScript is a BASIC derivative that uses many of the same statements and function names, so most developers will find it easy to understand and use without too much relearning.
While this course teaches the basics of LotusScript, its primary emphasis is not on the language itself, but rather on how to use it to operate on Notes database, view, document, field, and ACL objects. With this knowledge, you will be able to develop powerful custom applications and extend the standard templates such as Mail or Discussion.
Course goals
This course will teach you how to:
- use fundamental LotusScript language elements as you program and debug applications using Domino Designer
- use LotusScript in various Notes events to operate on objects in the Domino Object Model
- configure client, server, database, and document security mechanisms to allow LotusScript to operate
- reconcile LotusScript and Notes data types and validate user input
- design error handling routines to gracefully recover from runtime errors
- operate on new and existing documents as well as on collections of documents
- operate on the database ACL and develop an alternative user interface so users can more easily administer database security
- interact with users with both the primitive LotusScript and sophisticated Notes dialog boxes
- develop server-based Agents that use LotusScript and Notes objects to process documents
- debug Agents using the Remote LotusScript Debugger, report errors to a log file, profile Agent performance, and work with your server administrator to develop application probes to monitor ongoing Agent performance
Audience
This course is designed for Notes programmers well versed in using Domino Designer 8.5.x./9 It assumes that you have:
- extensive experience using Notes 8.5.x/9
- thorough knowledge of the Domino Designer 8.5.x/9 development environment, including Form and View design
- mastered the concepts covered in the Domino Designer Fundamentals training. The course does not review any aspects of the non-LotusScript specific development environment such as how to design forms or views.
Outline
Topic 1: LotusScript in Notes and Domino
What is LotusScript?
Advantages of LotusScript for Notes/Domino
When to use LotusScript
Where the code runs
LotusScript respects security
What LotusScript cannot do
Limits and performance
Other resources
Topic 2: Lotus Notes Event Handlers
Event-driven language
Enter LotusScript code using classic LotusScript Editor
Automatic code completion
Programmers Pane properties
Print code
Syntax errors
Compile and test the code
Exercise: Create button event script
Eclipse-based LotusScript Editor
What is the sequence of events?
Exercise: Experience the event model
Working with event handlers
Understanding Query and Post event
Recalculate document event
Save document event
Close document event
Switch modes events
Read document events
Agent events
Database events
View events
Field events
Topic 3: Debugging
Script errors
Script Debugger
Find errors
Debugger buttons
Debugger tabs
Exercise: Use the Debugger
Exercise: Breakpoints
Persistent breakpoints
Debugging with Msgbox and Print
Topic 4: Language Fundamentals
Basic language rules
Remark code
Variables
Declare variables
Advantages of explicit declaration
Constants
Statements and functions
MessageBox parameters and return values
InputBox
Exercise: Experience LotusScript functions
String functions
Math functions
Date functions
Data type conversion
Boolean operators
Global variables and scope
Exercise: Global variables
Code branching based on platform
Topic 5: Domino Object Model
What is an object?
Object class properties and methods
Domino Object Model
Back-end vs. Front-end classes
Back-end object classes
Front-end object classes
How Designer Help helps
Topic 6: Notes Object Instantiation
Object instantiation steps
How to instantiate an object
Containment hierarchy/sequence
Object reference variables
Access current database using back-end methods
Exercise: Object containers
Access other databases using back-end methods
Access other database on server
Exercise: Instantiate object in another database
Notes object properties
Read object property
Set object property
"With" statement
Notes object methods
Run Notes object methods
Three types of methods
Exercise: Open method
Exercise: Open database for user
Delete object reference
Topic 7: NotesSession Object Operations
Session properties
NotesName object class
NOTES.INI access
Data type assignment from environment
Exercise: Set environment
Environ$ function
Topic 8: NotesDatabase Object Operations
Paths to instantiate NotesDatabase
Select and open database
Create a new NotesDatabase object
Exercise: This database Info
Exercise: Parts database Info
Iterate notes\data folder to look for a database
NotesReplication class
Exercise: NotesReplication class
Open database for user in UI
Open a database by property
Error handling when opening databases
Exercise: Find database
Create non-replica database copy
Who can create a database?
Copy documents to new database
Exercise: Database Copy
Error handler review
Create replica copy
New database from design template
ACL of new database from CreateFromTemplate
Delete database
Topic 9: NotesDocument Object Operations
New document (back-end)
Security issues with back-end methods
Document properties
Exercise: Create Document (back-end)
New document using Form (front-end)
Security issues with front-end methods
Exercise: Create NotesUIDocument object
Topic 10: UI Object Classes
NotesUIWorkspace object
Close method
NotesUIDocument object
Instantiating the current UI document object
Front-end UI methods
Back-end to front-end interaction
Example of back-end to front-end interaction
NotesUIDocument limitations
Using the "Source" object reference variable
Instantiating container object
Exercise: Flip-Flop via back-end methods
Exercise: Flip-Flop via front-end methods
NotesUIView object
Refresh a View
Topic 11: Program Control Structures
Program structure
Experience control structures
Branching structures
Exercise: Branching structures
Looping structures
Looping performance
Code benchmarking
Exercise: Looping
How to exit a structure
Break out of an endless loop
Exercise: Exit a structure
Topic 12: User Input Validation and Error Handling
Check for empty variable
Failure to exit loop
Check data type
Other data type tests
Exercise: User input validation
Error handler
Resume after error
Goto after error
Resume 0
Specific error number handling
Reverse engineer Err codes
Error cases
Exercise: Error handling
Multiple error handlers
Error handlers and the Debugger
Topic 13: Notes Data Validation
Form translation and validation
Check empty object
Example: Check empty object
Check for empty item (Field)
Example: Check for empty item (Field entry)
Accessing fields in a Form
Field focus
Simple Field validation
Exercise: Item validation
Compute with Form
Continue variable
Example 1: Set Continue to stop a Form from closing
Example 2: Set Continue to require Action Button clicks
Example 3: Set Continue to stop deleting documents from a folder
Example 4: Set Continue to stop users from pasting documents
Topic 14: NotesItem Object Operations
Create a new item Option 1: Extended class syntax
Data type of a new item
Create a new item Option 2: NotesItem object New method
Item properties you can set
Create a new item Option 3: Document object method
Create a new item Option 4: AppendItemValue method
Read item values Option 1: Extended class syntax
Read item values Option 2: NotesItem object Values property
Read item values Option 3: Use GetItemValue method
Modify existing item values
Best practice: Be sure an item exists before using it
Access system fields
Read all items
Remove item
Exercise: Manipulate NotesItem objects
Challenge Exercise I: System Inventory
Objects required for Challenge Exercise
Pseudocode for Challenge Exercise
Topic 15: RichTextItem Object Operations
Rich Text programmatic issues
Instantiate NotesRichTextItem object
Accessing existing NotesRichTextItem objects
Things you can add to Rich Text item
Append text
Append spacing
Append character styles
Append doclink
Exercise: Formatted Rich Text
Append file attachment
Detach attachment
Append another NotesRichTextItem
Abstract text
Navigate through the elements in a Rich Text item
Insert object into existing Rich Text
Example: Append and populate table
Reopen document to show Rich Text
NotesUIDocument techniques to work with Rich Text Field
Validate Rich Text entry
NotesRichTextItem object Update and Compact methods
Topic 16: Collection of Document Objects
Work on existing document(s)
NotesDocumentCollection object
Security issues
Shifting collections and error trapping
GetNextDocument syntax
Exercise: Loop through a collection
Solution: Loop through a collection
Create an empty collection
Add NotesDocument object to a collection
Remove NotesDocument object from a collection
Manipulate a collection
Batch changes to documents in a collection
Security is enforced with StampAll and RemoveAll
Sort a collection
Build a collection from Note objects
Collections and performance
Topic 17: View-Based Document Object Collections
NotesView object
Exercise: Loop through NotesView
Solution: Loop through NotesView
Resort the NotesView collection
NotesDocument object ColumnValues property
Primary key and View concerns
Get a document or document collection by View key
Example: Build a collection by View key
Process descendant documents
Iterate all levels of a document hierarchy
Sibling documents
Access a documents parent document
NotesViewEntryCollection object
EntryCount property
GetEntryByKey and GetAllEntriesByKey
NotesViewEntry and NotesDocument objects
Exercise: Status summary
Solution: Status summary
NotesViewNavigator object
Other ways to create a NotesViewNavigator
Example: CreateViewNavFromDescendants
Topic 18: Unprocessed, Selected, Unread Documents
Unprocessed documents
Unprocessed documents and user interaction
Agents and unprocessed documents
Unprocessed flag and Agents
Unprocessed search accuracy
Exercise: Unprocessed documents
Documents highlighted and/or selected in a View
"Source" and Database and View event handlers
Unread documents
Topic 19: Existing Document Operations
How to instantiate an existing NotesDocument object
Make a copy of the current document
Delete a document
Remove documents from the database
Security issues
Exercise: Archive selected documents
Test for locked document
Lock document
Does the document really need to be saved?
Soft deletions
Delete document open in Read mode
IsValid document? IsDeleted document?
Open user-selected document
Put document in Folder (back-end)
Put document in Folder (front-end)
Exercise: Put document(s) in Folder
Remove document(s) from Folder
Remove all Folders
Remove only personal Folders
Make Response document
Topic 20: Dialog Boxes
OpenFileDialog
SaveFileDialog
Prompt
Remove Docs from Folder using Prompt
Choose Database dialog box
PickListCollection
PickListStrings
Exercise: PickListStrings
Free Time dialogs
Notes Folder dialog
DialogBox
From where you can call the DialogBox method
Display status information to user
Case study: Bring the data here
Topic 21: Database Access Control List
User name review
Best practices
Minimum database access requirements
Find a known ACL entry level
ACL level constants
Iterate ACL entries
Other ACL permissions
Resolve Group or Organization wildcard name
Why control the ACL with LotusScript?
Add an ACL entry
-Default- special handling
Change the level of an entry
Rename an entry
Delete an entry
Exercise: ACL control
Set permissions
Set entry type
Add a Role
Associate an entry with a Role
Role resolution
Disassociate entry from Role
Rename Role
Remove a Role
ACL and replication
ACL, your server administrator, and company policy
Groups in the ACL
Topic 22: Custom Procedures and Script Libraries
Advantages of using procedures
How/where to define procedures
Function procedures
Call a function
Single function argument
Pass an array as an argument
Multiple function arguments
Example: ConvertTemp function
Example: ReplaceSubstring function
Exercise: Value translation
Exit a procedure
Sub procedures
Example: Sub procedure
Pass argument by reference
Pass argument by value
Create a LotusScript Library
Use "LibraryName" statement in Options
Exercise: Use a Script Library
Resource strings
Script Library tips
Recursion example: Process all child documents
Recursion example: Find root parent document
Recompile All LotusScript
%Include LSS file
Topic 23: Server-Based Agents
Create a new Agent
Trigger (Basics tab)
Target (Basics tab)
Document selection tab
Selecting unprocessed documents
Before new mail arrives trigger (Basics tab)
Agent security (Security tab)
Handling UI method errors in Agents
DelayUpdates property for Agents
Pass arguments at run time
Work queue architecture
Agent best practices
Topic 24: Agent Logging, Profiling, and Debugging
Domino Server Log
Private Agent log
Custom Agent Log
Agent performance and Agent Profiling
Remote LotusScript Debugger
Programme scope, delivery arrangements and suitability are confirmed during enquiry.