lotus notes - Calling script library in agent and button -
i want use following script library in button , in agent.
my script library code:validate
option public option declare dim sess notessession dim currentdb notesdatabase dim datadb notesdatabase dim doc notesdocument dim workspace notesuiworkspace dim uidoc notesuidocument dim rtitem notesrichtextitem sub initialize set sess = new notessession set currentdb = sess.currentdatabase set workspace = new notesuiworkspace set uidoc = workspace.currentdocument end sub function validateform ( source notesuidocument) boolean on error goto e set doc=source.document dim txt string dim trimmed string txt = doc.name(0) trimmed = trim(txt) if ( trimmed = "") msgbox "please enter text." source.gotofield("name") validateform= false else validateform= true end if exit function e: msgbox "error at"& erl() & " , error "& error() end function in button:
in button when call script library since in validateform function has source notesuidocument , in button click has souce button giving me error.
sub click(source button) end sub i have tried using in agent in options using below:
use "validate"
and tried calling in button using formula @command([toolsrunmacro]; "val") no use not getting desired output. new lotus notes.please me in doing above tasks.
you don't need take parameter @ all. in initialize- sub of script- library set global variable "uidoc" opened document:
set workspace = new notesuiworkspace set uidoc = workspace.currentdocument in function "validateform" omit parameter , replace "source" "uidoc"
set doc=source.document the other possibility (if want give current document parameter):
sub click( source button) dim ws new notesuiworkspace dim uidoc notesuidocument set uidoc = ws.currentdocument call validateform( uidoc ) end if or if keep initialize code in library:
sub click( source button) call validateform( uidoc ) end if this works, "uidoc" global variable, initialized sub initialize of script- library.
hth
Comments
Post a Comment