#7322
Support 1a
Participant

Here’s some sample code that checks the ‘To’ field to ensure it doesn’t contain more than 3 recipients. (The number can be changed by changing the value of the constant). The applet would need to be integrated with the OnSend event.

Please note this technique doesn’t check to see if any of the recipients are in groups. This requires a more complex solution.

I hope this helps.

Advansys Support

' This sample code will check the number of addresses in the TO field and stop
' sending the message if the addresses exceed the limit.  The applet must be
' integrated to fire in response to the OnSend event.

const IDS_EXCEED_LIMIT = 3


'-------------------------------------------------------------------------------
' Main line processing
'-------------------------------------------------------------------------------
sub Main(Client, GWEvent)

  ' Stop the send if the number of recipients exceeds IDS_EXCEED_LIMIT.
  if (GetTotalAddresses(groupwise.ItemGetText("X00", itfTo)) > IDS_EXCEED_LIMIT) then
    call msgbox("", vbExclamation, "Advansys Formativ")
    groupwise.CancelGroupWiseEvent = true
  end if

End Sub


'-------------------------------------------------------------------------------
' Get total number of addresses in the field.
'-------------------------------------------------------------------------------
function GetTotalAddresses(addresses)

  if (len(addresses) = 0) then
    GetTotalAddresses = 0
    exit function
  end if

  if (instr(1, addresses, ";", vbTextCompare) > 0) then
     GetTotalAddresses = ubound(Split(addresses, ";", -1, vbTextCompare)) + 1
  elseif (instr(1, addresses, ",", vbTextCompare) > 0) then
     GetTotalAddresses = ubound(Split(addresses, ",", -1, vbTextCompare)) + 1
  else
     GetTotalAddresses = 1
  end if

end function