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.
 
developerWorks
AIX and UNIX
Information Mgmt
Lotus
New to Lotus
Products
How to buy
Downloads
Live demos
Technical library
Training
Support
Forums & community
Events
Rational
Tivoli
WebSphere
Java™ technology
Linux
Open source
SOA and Web services
Web development
XML
My developerWorks
About dW
Submit content
Feedback



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

Notes/Domino 6 and 7 Forum

developerWorks

  

PreviousPrevious NextNext


fatsoua fatsoua 20.Oct.14 06:19 AM a Web browser
General All Releases All Platforms


I have created a form where the content manager can create a document relevant to a single or multiple topics (selection through check-box) and send it (via agent-email alert) to subscribed users (of that/those topics). The agent I have created works only with single choice topics, if the content manager chooses 2 or more topics, the agent recognizes only the first one. What am I doing wrong in the agent-script? Thanks in advance. Here's my agent:
Option Public
Sub Initialize
' Declarations
Dim db As NotesDatabase
Dim session As New NotesSession

' Instantiations
Set db = session.CurrentDatabase

Dim doc_Select_Users_for_Alert As NotesDocument
Dim view_Select_Users_for_Alert As NotesView
Dim doc_Alert As NotesDocument
Dim view_Alert As NotesView
Dim docType_gr As String

' Email Alert
Dim IntroductoryText_gr As String
Dim MainText_gr As String
Dim EndingText_gr As String

Parameter_Server = "intraweb01/gov"

Set view_Alert = db.GetView("xxx_alert")
Set doc_Alert = view_Alert.GetFirstDocument

If doc_Alert Is Nothing Then Exit Sub

IntroductoryText_gr = "Intro text ...:<br>"
EndingText_gr = "Ending text ..."

' Topic A
Dim subject21_gr As String
Dim subject21_Title_gr As String
Dim subject21_Main_gr As String

' Topic B
Dim subject22_gr As String
Dim subject22_Title_gr As String
Dim subject22_Main_gr As String

' Multiple Topics
Dim multcat1_gr As String
Dim multcat1_Title_gr As String
Dim multcat1_Main_gr As String

Server_AddressD="http://www.xxx.cy/xxx.nsf/"
Server_AddressP="http://www.xxx.cy"

Do Until doc_Alert Is Nothing

If doc_Alert.Form(0) = "xxx_new_el" Then

If doc_Alert.FMTYPE(0)="" Then
'do nothing

' Topic A
ElseIf doc_Alert.FMTYPE(0) = "1" Then
subject21_Title_gr = "<br><b>Topic A</b><br>" + "=======================================<br>"
subject21_Main_gr = subject21_Main_gr + doc_Alert.All_Attch(0) + "<br><br>"
docSubjectGR = doc_Alert.Statement(0)

'Topic B
ElseIf doc_Alert.FMTYPE(0) = "2" Then
subject22_Title_gr = "<br><b>Topic B</b><br>" + "=======================================<br>"
subject22_Main_gr = subject22_Main_gr + doc_Alert.All_Attch(0) + "<br><br>"
docSubjectGR = doc_Alert.Statement(0)

'Multiple Topics
ElseIf doc_Alert.FMTYPE(0) = "1" And doc_Alert.FMTYPE(0) = "2" Then
multcat1_Title_gr = "<br><b>Multiple Topics</b><br>" + "=========================================<br>"
multcat1_Main_gr = multcat1_Main_gr + doc_Alert.All_Attch(0) + "<br><br>"
docSubjectGR = doc_Alert.Statement(0)
End If

End If

doc_Alert.SentAlert = "1"
Call doc_Alert.Save(True,False)
Set doc_Alert = view_Alert.GetFirstDocument

On Error Resume Next

Loop

subject21_gr = subject21_Title_gr + subject21_Main_gr
subject22_gr = subject22_Title_gr + subject22_Main_gr
multcat1_gr = multcat1_Title_gr + multcat1_Main_gr

Dim yCounter As Integer

yCounter = 0

' Εmail Parameters
Dim docMail As NotesDocument
Dim Language As String
Dim docMailBody_A As String
Dim docMailBody_B As String
Dim body As NotesMIMEEntity
Dim header As NotesMIMEHeader
Dim stream As NotesStream

Set view_Select_Users_for_Alert = db.GetView("Users for Alerts by email")

Set doc_Select_Users_for_Alert = view_Select_Users_for_Alert.GetFirstDocument

Do Until doc_Select_Users_for_Alert Is Nothing

If doc_Select_Users_for_Alert.Form(0) = "xxx_el" Then
Language = "GR"
End If

If Language = "GR" Then
docMailBody_A = IntroductoryText_gr
End If

' Θέματα
For yCounter = 0 To UBound(doc_Select_Users_for_Alert.TopicsB)

' Topic A
If doc_Select_Users_for_Alert.TopicsB(yCounter) = "1" And Language = "GR" Then
If subject21_gr <> "" Then
docMailBody_B = docMailBody_B + subject21_gr
End If
End If

' Topic B
If doc_Select_Users_for_Alert.TopicsB(yCounter) = "2" And Language = "GR" Then
If subject22_gr <> "" Then
docMailBody_B = docMailBody_B + subject22_gr
End If
End If

' Multiple Topics
If doc_Select_Users_for_Alert.TopicsB(yCounter) = "1" And doc_Select_Users_for_Alert.TopicsB(yCounter) = "2" And Language = "GR" Then
If multcat1_gr <> "" Then
docMailBody_B = docMailBody_B + multcat1_gr
End If
End If

Next yCounter

If Language = "GR" Then

If docMailBody_B <> "" Then
Set stream = session.CreateStream
Set docMail = New NotesDocument(db)
Set body = docMail.CreateMIMEEntity
docMail.Form = "Memo"
docMail.Principal = "XXX"
docMail.Subject = "XXX - email Alert: " + docSubjectGR

session.ConvertMIME = False ' Do not convert MIME to rich text
Call stream.WriteText(docMailBody_A + Chr(13) + Chr(13) + docMailBody_B + Chr(13) + Chr(13) + EndingText_gr)
Call body.SetContentFromText _
(stream, "text/html;charset=UTF-8", ENC_NONE)
Call docMail.Send(False, doc_Select_Users_for_Alert.alert_email(0))
session.ConvertMIME = True ' Restore conversion
docMailBody_B = ""
End If

End If

Set doc_Select_Users_for_Alert = view_Select_Users_for_Alert.GetNextDocument(doc_Select_Users_for_Alert)

On Error Resume Next

Loop

session.ConvertMIME = True ' Restore conversion

End Sub






email alerts-agent/lotuscript assis... (fatsoua fatsoua... 20.Oct.14)
. . RE: email alerts-agent/lotuscript a... (Karl-Henry Mart... 20.Oct.14)
. . . . RE: email alerts-agent/lotuscript a... (fatsoua fatsoua... 21.Oct.14)
. . . . . . It doesn't loop on the multipkle se... (Carl Tyler 21.Oct.14)
. . . . . . RE: email alerts-agent/lotuscript a... (Karl-Henry Mart... 21.Oct.14)





  Document options
Print this pagePrint this page

 Search this forum

  Forum views and search
Date (threaded)
Date (flat)
With excerpt
Author
Category
Platform
Release
Advanced search

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

Resources

 Resources
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

Wikis

 Wikis
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