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