Genesys CTI User Forum
Genesys CTI User Forum => Genesys CTI Technical Discussion => Topic started by: tlthomas89 on September 19, 2011, 02:40:39 PM
-
Hello! I am new to CC Pulse and VB script so bare with me :)
I have created an email alert that will send a message to the supervisor if too many agents are not available for calls in a queue. The email includes the agent's ID and status. Everything seems to work fine but a seperate email is being sent for each agent instead of one email being send listing all agents in the queue. I am guessing I need some sort of 'loop' or 'next record' command but can not find anything that is working. Hopefully someone can help me out? The code is below:
Dim msgBody
Dim thresholdInfo
msgBody="At this time, there are less than 2 agents available for calls"+vbNewLine
thresholdInfo="StatValue:"+CStr(Threshold.StatValue) + vbNewLine + _
"Agent/Queue:" + CStr(Threshold.CFGObjectId) + vbNewLine + _
"CFGType:"+CStr(Threshold.CFGType) + vbNewLine+vbNewLine+vbNewLine+vbNewLine
'Call our function with profile, recipient, message, and subject
SendMail "","",msgBody+thresholdInfo,"Too Many Not Ready!!"
Sub SendMail(profile, recipient,msg,subject)
Dim objSession, objAddrEntry, oInbox, colMessages, oMessage, colRecipients, oRecipient
Set objSession = CreateObject("MAPI.Session")
objSession.Logon profile,"",True,False,0, False
Set objAddrEntry = objSession.CurrentUser
Set oInbox = objSession.Inbox
Set colMessages = oInbox.Messages
Set oMessage = colMessages.Add()
Set colRecipients = oMessage.Recipients
recipient = "XXXXXXX"
If recipient = "" Then
colRecipients.Add objAddrEntry
Else
colRecipients.Add recipient
End If
colRecipients.Resolve
oMessage.Subject = subject
oMessage.Text = msg
oMessage.Send
objSession.Logoff
Set objSession = nothing
End Sub