|
|
|
|
|
|
|
|
|
|
|
|
|
|
LotusScript agents and the Web (continued)
This function will only work for names that do NOT have a middle name or a last name with a space. There are several examples of recursive functions that will support those situations, but for now, this one will work for this example. What we're doing is moving to the first occurrence of a plus sign (+) and setting all the characters before that first plus sign to the variable firstname, and then setting all the remaining characters after the plus sign to the variable lastname. We add the two variables together with a space and we have Chris Stoner. This is the hard way of doing @ReplaceSubstring(UserN; "+"; " "), but I'm trying to show other uses for Instr and Mid, as they're powerful tools for the LotusScript Developer.
Next, we use our parameters to mark our document Approved:
REM get handle to the Document that we need to modify...
Dim db As Notesdatabase
Dim doc As Notesdocument
Dim session As New NotesSession
Set db = session.CurrentDatabase
Set doc = db.GetDocumentByUNID(docID)
|
First, we need to find the correct document. We'll search by the document ID in our variable docID, which was passed to the Agent. Once we have a handle to the document, we simply set it to be Approved with the Approver's name and the current date.
Dim test As String
doc.RemoveItem("Approver")
doc.Approver=frmtName$
doc.RemoveItem("ApproveYN")
doc.ApproveYN="Approved"
doc.RemoveItem("ApproveDate")
doc.ApproveDate= Format(Now(), "mm/dd/yy")
|
We must save this Agent so our changes will appear when the document is next viewed.
Call doc.Save( True, True )
|
Let's return the Approver to the document that they just approved.
'Return to document we just approved....
Print "[/" & db.filepath & "/all/" & docID & "?OpenDocument]"
|
Now the process is complete.
Closing Many developers have LotusScript Agents that they currently use within the Lotus Notes environment for a variety of purposes. With this example, I hope that you'll be able to consider whether or not these Agents can be modified to be used over the Web as well.
Bulk reprints Bulk reprints of this article (in quantities of 100 or more) are available for a fee from Reprint Services, a ZATZ business partner. Contact them at reprints@zatz.com or by calling 1-800-217-7874.
|
Chris Stoner, formerly Chris Brown, is a Principal CLP Notes Developer (R4 and R5) currently based in the Washington, DC Metro Area. Other Notes Developers may recognize Chris by her alias, Green Jellybean, which is the nickname for her green Toyota RAV4. She can be contacted at green_jellybean@bookideas.com.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- Advertisement --
Learn Notes and Domino 8 at your place and pace!
Learn Notes and Domino in your office and/or home! TLCC's highly acclaimed distance learning courses for users, developers, and admins will enhance your career and your resume.
The many included activities and demos will make you a pro! Expert instructor help is a click away.
Click here to try a FREE demo course!! |
-- Advertisement --
Mark your calendar for in-depth Lotus training, May 12-14, Boston
Join experts and peers May 12-14 in Boston for educational and networking events that deliver real-world Lotus training so you can increase productivity and efficiency in your company, advance your skills, and squeeze the most from your current environment. One registration gets you into THE VIEW's Admin2010 and Lotus Developer2010.
Register by April 10 to save $200. |
|
|
|
|
|
|
|
|
|
|