Skip to main content
This forum is closed to new posts and responses. New discussions are now taking place in the IBM Developer Answers forum.
Information Mgmt
New to Lotus
How to buy
Live demos
Technical library
Forums & community
Java™ technology
Open source
SOA and Web services
Web development
My developerWorks
About dW
Submit content

developerWorks  >  Lotus  >  Forums & community  >  Notes/Domino 6 and 7 Forum

Notes/Domino 6 and 7 Forum



PreviousPrevious NextNext

Mark XY Brown 1.Nov.12 01:14 PM a Web browser
Domino Designer 6.0.3 Windows XP

Got another frustration here.

The Powers That Be like having a Notes database to handle the invitations to the Christmas party each year. Each year, the databases need more and more features. My problem this year is to create an action against an Invitee document that will allow the organisers to manually send an invitation to a latecomer.

The database has a number of forms. The ones impacted here are:
Invitee (Name and address of invitee, as well as their internal/external flag, and Invited, Responded and Attending flags)
OGM (Message title, invitation flag, whether this message is destined for internal or external invitees, message fields)

As it takes fields from two documents to compose a message, I set up an action on the Invitee form and an agent.

The action prompts the organiser for a message (workspace pick list, source view categorised on the invitee's internal/external status), and then dumps the message's UNID and the invitee's UNID into a temporary document. It passes the note ID of the temporary document to the agent.

The agent calls back the temporary document and then interrogates it for the UNIDs of the other two documents. Then it analyses the values in them and composes an invitation accordingly. It sends and then purges the invitation, and deletes the temporary document.

The action, meanwhile, has been polling the database for the temporary document. As soon as it's not found, it alerts the organiser that the invitation has been sent.

Well, that was the plan. If I step through the code, I can generate a temporary document. I can then manually call back that document in the agent, and the code all runs as I expect. If I try letting it run normally, the action generates an endless loop.

Action script:
Sub Click(Source As Button)
'Pass parameters to the (ManualSend) agent to invite this person

Dim ws As New NotesUIWorkspace
Dim sess As New NotesSession
Dim db As NotesDatabase
Dim agnSend As NotesAgent
Dim namServer As NotesName
Dim docThis As NotesDocument
Dim docParam As NotesDocument

Dim strServer As String
Dim strFile As String
Dim strInt As String
Dim varOGMID As Variant
Dim strOGMID As String
Dim strInvID As String
Dim strParam As String

Set db = sess.CurrentDatabase
Set docThis = ws.CurrentDocument.Document
Set agnSend = db.GetAgent("(ManualSend)")
Set docParam = New NotesDocument(db)

Set namServer = New NotesName(db.Server)
strServer = namServer.Common

strFile = db.FilePath
strFile = Left(strFile, Instr(1, strFile, ".")-1)

strInt = docThis.GetItemValue("IsInternal")(0)

varOGMID = ws.PickListStrings(PICKLIST_CUSTOM, False, strServer, strFile , _
"Messages", "Manually send invitation", _
"Select an OGM to use for " & docThis.GetItemValue("FullName" & strInt)(0), _
4, strInt)

If Isempty(varOGMID) Then Exit Sub

strOGMID = varOGMID(0)
strOGMID = Left(strOGMID, Instr(1, strOGMID, "~")-1)

strInvID = docThis.GetItemValue("DocRefID")(0)

docParam.InvID = strInvID
docParam.OGMID = strOGMID
Call docParam.Save(True, False)
strParam = docParam.UniversalID

Set docThis = Nothing 'Precaution against the agent not being able to modify this doc

Call agnSend.RunOnServer(strParam)

Set docParam = Nothing
Set docParam = db.GetDocumentByUNID(strParam)

Do Until docParam Is Nothing

Set docParam = Nothing
Set docParam = db.GetDocumentByUNID(strParam)


Messagebox "Invitation sent!", 64, "Manually send invitation"

End Sub

Agent script:
Sub Initialize
'Send out an invitation to the person named in the passed document

Dim sess As New NotesSession
Dim db As NotesDatabase
Dim agnThis As NotesAgent
Dim docParam As NotesDocument
Dim docInv As NotesDocument
Dim docOGM As NotesDocument
Dim docMemo As NotesDocument

Dim strParam As String
Dim strInvID As String
Dim strOGMID As String
Dim strName As String
Dim strMessage As String

Set db = sess.CurrentDatabase
Set agnThis = sess.CurrentAgent
strParam = agnThis.ParameterDocID
Set docParam = db.GetDocumentByUNID(strParam)

Set docInv = db.GetDocumentByUNID(docParam.GetItemValue("InvID")(0))
Set docOGM = db.GetDocumentByUNID(docParam.GetItemValue("OGMID")(0))

strOGMID = docOGM.GetItemValue("OGMID")(0)
strInvID = docInv.GetItemValue("InvID")(0)

If docInv.GetItemValue("IsInternal")(0) = "E" Then

'External invitee
Set docMemo = New NotesDocument(db)

strName = docInv.GetItemValue("FullNameE")(0)
strName = Left(strName, Instr(1, strName, " ")-1)

strMessage = docOGM.GetItemValue("FormOfAddress")(0)
strMessage = strMessage & strName & Chr(13) & Chr(13)
strMessage = strMessage & docOGM.GetItemValue("BodyText")(0)

With docMemo

.Form = "Memo"
.SendTo = docInv.GetItemValue("ExternalAddress")(0)
.Subject = docOGM.GetItemValue("Subject")(0)
.Body = strMessage

End With


'Internal invitee
Set docMemo = docOGM.CopyToDatabase(db)
docMemo.SendTo = docInv.GetItemValue("NotesName")(0)
docMemo.Form = "Memo"

End If

Call docMemo.ComputeWithForm(False, False)
Call docMemo.Send(False)
Call docMemo.RemovePermanently(True)
Set docMemo = Nothing

docInv.Invited = "1"
Call docInv.Save(True, False)

Call docParam.RemovePermanently(True)

End Sub

Any ideas?
Thanks for reading this far!

RunOnServer apparently not running (Mark XY Brown 1.Nov.12)
. . RE: RunOnServer apparently not runn... (Stan Rogers 1.Nov.12)
. . . . RE: RunOnServer apparently not runn... (Mark XY Brown 2.Nov.12)
. . . . . . RE: RunOnServer apparently not runn... (Stan Rogers 2.Nov.12)
. . . . RE: RunOnServer apparently not runn... (Mark XY Brown 2.Nov.12)

  Document options
Print this pagePrint this page

 Search this forum

  Forum views and search
Date (threaded)
Date (flat)
With excerpt
Advanced search

 RSS feedsRSS
All forum posts RSS
All main topics RSS
More Lotus RSS feeds


Forum use and etiquette
Native Notes Access
Web site Feedback

Lotus Support

 Lotus Support
IBM Support Portal - Lotus software
Lotus Support documents
Lotus support by product
Lotus support downloads
Lotus support RSS feeds


IBM Composite Applications
IBM Mashup Center
IBM Connections
IBM Connections Cloud Developers
IBM Docs
IBM Forms
IBM Mobile Connect
IBM Sametime
IBM SmartCloud for Social Business
IBM Web Experience Factory
Lotus Domino
Lotus Domino Designer
Lotus Expeditor
Lotus Foundations
Lotus iNotes
Lotus Instructor Community Courseware
Lotus Notes
Lotus Notes & Domino Application Development
Lotus Notes Traveler
Lotus Protector
Lotus Quickr
Lotus Symphony
IBM Web Content Manager
WebSphere Portal

Lotus Forums

 Lotus Forums
Notes/Domino 9.0
Notes/Domino 8.5 + Traveler
Notes/Domino XPages development forum
Notes/Domino 8
Notes/Domino 6 and 7
IBM Connections
IBM Mobile Connect
IBM Sametime
IBM SmartCloud Notes
Lotus Enterprise Integration
Lotus Protector
Lotus Quickr
Lotus SmartSuite