Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Multiple selections in agent

Posted on 2006-11-21
9
Medium Priority
?
257 Views
Last Modified: 2013-12-18
Have an agent which is triggered by a button, I am having trouble getting the code right so it will allow me to select multiple docs from a view and have the code below run on each. What adjustments can I try to get this to work.


Sub Initialize
      Dim session As New NotesSession
      Dim db As NotesDatabase
      Dim uidoc As NotesUIDocument
      Dim doc As NotesDocument
      Dim emaildoc As NotesDocument
      Dim Item As NotesItem
      Dim i As Integer
      Dim rtitem As NotesRichTextItem
      Dim dc As NotesDocumentCollection
      Set db = session.CurrentDatabase
      Set dc = db.UnprocessedDocuments
      
      On Error Resume Next
      Set doc = dc.GetFirstDocument
      For i = 1 To dc.Count
            Set doc = dc.GetNthDocument( i )
            If doc.invited_flag(0)<>"done" Then
                  Set emaildoc = db.CreateDocument
                  emaildoc.form = "bb_invite" 'Form name of Letter
                  emaildoc.SendTo = doc.EE_Name(0)
                  emaildoc.CopyTo = "Field Technology"
                  emaildoc.BlindCopyTo = doc.bcc
                  emaildoc.Principal = "Field Technology"
                  emaildoc.Subject ="MetLife BlackBerry offer extended to " +  doc.EE_Name(0) + "!"
                  emaildoc.EE_Name = doc.EE_Name
                  emaildoc.ReturnReceipt="1"
                  Set rtitem = New NotesRichTextItem(emaildoc, "Doclink")
                  Call rtitem.AppendDocLink(doc, "")
                  Call emaildoc.Send(True)
                  doc.invited_flag = "done"    'field name for flag
                  doc.status = "Offer Sent"
                  Call doc.Save(True,True)
            End If
      Next
End Sub
0
Comment
Question by:jforget1
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 3
9 Comments
 
LVL 63

Expert Comment

by:SysExpert
ID: 17989366
This appears to be correct in general.
The dc should contain the selected docs for processing.

I would consider doing get first ad get next rather than get nth doc.

What appears to be the problem ?

I hope this helps !

0
 

Author Comment

by:jforget1
ID: 17989473
It only sends the doc that is highlighted and not the others which I have placed a check next to. Not sure what the problem is.
0
 
LVL 8

Accepted Solution

by:
behenderson earned 2000 total points
ID: 17989475
Goto the DocumentSelection Section and then open a properties box

In the properties box make sure selected documents is chosen
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:jforget1
ID: 17989492
Do you mean in debugger?
0
 
LVL 8

Expert Comment

by:behenderson
ID: 17989550
In the agent window when you ar coding the agent (I am assuming you are in 6.5) there is Declarations Initialize Options and DocumentSelection
0
 
LVL 63

Expert Comment

by:SysExpert
ID: 17989602
It is also in the Target section of the Agent properties.

Make sure it is set to
All selected docuemtns.

I hope this helps !
0
 
LVL 63

Expert Comment

by:SysExpert
ID: 17989619
Actually in the Runtime Section, Target Field.
0
 

Author Comment

by:jforget1
ID: 17989625
Oh my god that was it, something so simple, should have picked that up.
0
 
LVL 8

Expert Comment

by:behenderson
ID: 17989645
If you are in an older version it is in the agent window which documents should this act on
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

You’ve got a lotus Domino web server, and you have been told that “leverage browser caching” is a must do. This means that we have to tell the browser everywhere in the web to use cache. In other words, we set (and send) an expiration date in the HT…
Problem "Can you help me recover my changes?  I double-clicked the attachment, made changes, and then hit Save before closing it.  But when I try to re-open it, my changes are missing!"    Solution This solution opens the Outlook Secure Temp Fold…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question