Home > Domino Tips > Developer > LotusScript > Change view design or scheduled agent runtimes
Domino Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

LOTUSSCRIPT

Change view design or scheduled agent runtimes


T. Brian Nichols
05.27.2004
Rating: -4.00- (out of 5)


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


View member feedback to this tip.

I wrote this LSX so developers could use LotusScript to set a parameter doc (NotesDocument) with view criteria (formulas, settings, columns, etc) and then build it. If the view exists, it modifies it; otherwise, it creates it. It also includes an agent class you can use to modify agent schedules from LotusScript. After you install the LSX, you'll need to restart the Notes client(s) for the LSX to properly register.

To do this without this LSX, you would need knowledge of the C or C++ APIs.

Code: Download here.

Examples
-------------
Customizing view note:
Dim view as CView
Dim s as New NotesSession
Dim db as New NotesDatabase("", "")
Dim doc as NotesDocument

Call db.open("Your server", "tbnlsxtest.nsf")
 ' Use your own database
Set doc = New NotesDocument(db)

doc.Form = "ParmDoc"
doc.ViewName = "MyTestView" '
 This is the only necessary parm. Defaults will be
used for all other parms that do not exist.
'doc.ViewSelection = {SELECT Form = "MyForm"}
doc.AltRowColorR = 192 ' 1..255
doc.AltRowColorG = 192 ' 1..255
doc.AltRowColorB = 255 ' 1..255
doc.BGColorR = 222 ' 1..255
doc.BGColorG = 226 ' 1..255
doc.BGColorB = 226 ' 1..255
doc.Alias = "MyAlias"
doc.Comment = "My test view..."
'...
doc.Save False, True, True ' you need to 
save the parm doc in the database 
where you want the view to be made.

Set view = New CView(doc)
Call view.BuildView()

doc.Remove True 

Customizing a scheduled agent's run time:
Option Public
Option Declare

%REM
// PARM DOC FIELDS
#define FIELD_AGENTNAME "AgentName"
#define FIELD_ASSISTSEARCH "AssistSearch"
#define FIELD_ASSISTTRIGGER "AssistTrigger"
#define FIELD_COMMENT "Comment"
#define FIELD_ENDHOUR "EndHour"
#define FIELD_ENDMINUTE "EndMinute"
#define FIELD_INTERVAL "Interval"
#define FIELD_INTERVALTYPE "IntervalType"
#define FIELD_ISENABLED "IsEnabled"
#define FIELD_ISHIDDEN "IsHidden"
#define FIELD_ISNEWCOPY "IsNewCopy"
#define FIELD_ISPRIVATE "IsPrivate"
#define FIELD_ODSFLAGS "ODSFlags"
#define FIELD_RUNONSERVER "RunOnServer"
#define FIELD_STARTHOUR "StartHour"
#define FIELD_STARTMINUTE "StartMinute"
%END REM

'Uselsx "C:lsxbinw32chrysalis.dll"
Uselsx "*Chrysalis"
Const ASSISTODS_FLAG_HIDDEN&     
 = &h00000001
 '/* TRUE if manual assistant is hidden */
Const ASSISTODS_FLAG_NOWEEKENDS&   
 = &h00000002 '/*
 Do not run on weekends */
Const ASSISTODS_FLAG_STOREHIGHLIGHTS&  
 = &h00000004 '/*
                TRUE if storing highlights */
Const ASSISTODS_FLAG_MAILANDPASTE&   
 = &h00000008 '/*
                TRUE if this is the V3-style mail and 
paste macro */
Const ASSISTODS_FLAG_CHOOSEWHENENABLED&
  = &h00000010 '/* 
                TRUE if server to run on should be 
chosed when enabled */

Const ASSISTTRIGGER_TYPE_NONE%    = 0 '/* 
     Unknown or unavailable */
Const ASSISTTRIGGER_TYPE_SCHEDULED%   = 1 '/*
     According to time schedule */
Const ASSISTTRIGGER_TYPE_NEWMAIL%   = 2 '/* 
     When new mail delivered */
Const ASSISTTRIGGER_TYPE_PASTED%    = 3 '/*
     When documents pasted into database */
Const ASSISTTRIGGER_TYPE_MANUAL%      = 4 '/*
     Manually executed */
Const ASSISTTRIGGER_TYPE_DOCUPDATE%   = 5 '/* 
     When doc is updated */
Const ASSISTTRIGGER_TYPE_SYNCHNEWMAIL%  
= 6 '/* 
     Synchronous new mail agent executed by router */

Const ASSISTSEARCH_TYPE_NONE%     = 0 '/*
     Unknown or unavailable */
Const ASSISTSEARCH_TYPE_ALL%     = 1 '/*
     All documents in database */
Const ASSISTSEARCH_TYPE_NEW%     = 2 '/*
     New documents since last run */
Const ASSISTSEARCH_TYPE_MODIFIED%   = 3 '/* 
    New or modified docs since last run */
Const ASSISTSEARCH_TYPE_SELECTED%   = 4 '/*
    Selected documents */
Const ASSISTSEARCH_TYPE_VIEW%       = 5 '/* 
    All documents in view */
Const ASSISTSEARCH_TYPE_UNREAD%    = 6 '/* 
   All unread documents */
Const ASSISTSEARCH_TYPE_PROMPT%    = 7 '/* 
   Prompt user */
Const ASSISTSEARCH_TYPE_UI%     = 8 '/*
   Works on the selectable object */
Const ASSISTSEARCH_TYPE_COUNT%    = 9 '/* 
   Total number of search types */

Const ASSISTINTERVAL_TYPE_NONE%    = 0 '/* 
   Unknown */
Const ASSISTINTERVAL_TYPE_MINUTES%   = 1
Const ASSISTINTERVAL_TYPE_DAYS%    = 2
Const ASSISTINTERVAL_TYPE_WEEK%    = 3
Const ASSISTINTERVAL_TYPE_MONTH%   = 4

Dim s As notessession
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim agent As CAgent
Sub Initialize 
 Set s = New NotesSession
 Set db = s.currentdatabase
 Dim dbt As New notesdatabase("", "")
 Call dbt.open(db.server, "somedb.nsf")
 Set doc = New NotesDocument(dbt)
 
 doc.Form = "ParmDoc"
 doc.AgentName = "MyAgent"
 doc.Comment = "Last updated: " & Now
' ex: give it  a start time 
 doc.StartHour = 13
 doc.StartMinute = 30
 doc.AssistTrigger = ASSISTTRIGGER_
TYPE_SCHEDULED
 doc.AssistSearch = ASSISTSEARCH_TYPE_ALL
' ex: Run every hour and 30 minutes:
 doc.IntervalType = ASSISTINTERVAL_TYPE_
MINUTES
 doc.Interval = 90
 
 doc.IsEnabled = 1 
 Dim nn As New notesname(dbt.server)
 doc.RunOnServer = nn.canonical
 
 doc.Save False, True, True
 
 Set agent = New CAgent(doc)
 Call agent.BuildAgent()
 
 doc.Remove True
End Sub

MEMBER FEEDBACK TO THIS TIP

Notes R6 has XML support. It is very well-suited for a view, and any other design element creation and update.

—Giedrius L.

Do you have comments on this tip? Let us know.

This tip was submitted to the SearchDomino.com tip exchange by member T. Brian Nichols. Please let others know how useful it is via the rating scale below. Do you have a useful Notes/Domino tip or code to share? Submit it to our monthly tip contest and you could win a prize and a spot in our Hall of Fame.

Rate this Tip
To rate tips, you must be a member of SearchDomino.com.
Register now to start rating these tips. Log in if you are already a member.




Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   



RELATED CONTENT
LotusScript
LotusScript agent parses ACL to Microsoft Notepad
LotusScript finds the first occurrence of a string from the right
Clear Recent Contacts view and prevent repopulation in Lotus Notes 8.x
Search Microsoft Active Directory with LotusScript
Three steps to trap and handle save conflicts with LotusScript
Troubleshoot agents by displaying LotusScript variables online
LotusScript sorts lists alphabetically
LotusScript code rebuilds corrupted busytime.nsf file
Soft-code item names to facilitate LotusScript management
LotusScript agent automates selective mail file replication

LotusScript
LotusScript agent parses ACL to Microsoft Notepad
LotusScript finds the first occurrence of a string from the right
Clear Recent Contacts view and prevent repopulation in Lotus Notes 8.x
Search Microsoft Active Directory with LotusScript
Three steps to trap and handle save conflicts with LotusScript
Troubleshoot agents by displaying LotusScript variables online
LotusScript sorts lists alphabetically
Run or restart Notes/Domino agents via text messages
LotusScript code rebuilds corrupted busytime.nsf file
Soft-code item names to facilitate LotusScript management

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary

DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.



Domino & Lotus Notes Security Solutions: Authentication, Antispam, Encryption and Antivirus
HomeTopicsITKnowledge ExchangeTipsAsk the ExpertsMultimediaWhite PapersDomino IT Downloads
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 1999 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts