/ Forums / Advansys Formativ / Creating Solutions with Formativ / If-then-else statement , if mail is send local / Reply To: If-then-else statement , if mail is send local


Hate to push my luck, but this all seems easy for you. I want to make sure that the disclaimer only gets inserted only once since it is obnoxiously long, so I want to key off of the Send event and search the BodyText of the message for language particular to part of my disclaimer, i.e.”disclaimer/confidentiality”. If the text is found then I don’t want to insert it again.

I don’t see an ItemFindText method in the GroupWise tokens API, so I have tried to simply extract the message body into a variable using the ItemGetText method and then check the variable for “disclaimer/confidentiality.” I am stuck again. Here is my code:

Sub Main(Client, GWEvent)
Dim FileObj
Dim sMsg

On Error Resume Next
If ValidMsg(sMessage) And (GWEvent = “GW#C#SEND”) Then
Set FileObj = CreateObject(“Scripting.FileSystemObject”)
call GroupWise.FocusSet(fcsMessage, “”)
‘None of the following 3 work and all I get is a generic ‘an error has occurred at column 0’:
sMsg = Client.ClientState.CommandMessage.BodyText
sMsg = GroupWise.ItemGetText(Client.ClientState.CommandMessage.MessageID, fcsMessage)
sMsg = GroupWise.ItemGetText(Client.ClientState.CommandMessage.MessageID, Message)

If (Instr(1, sMsg, “disclaimer/confidentiality”) = 0) Then
msgBox “Did not find disclaimer language”
msgBox “Found the disclaimer language”
‘ End If
Set FileObj = Nothing
End if
End Sub

Loading the whole Body Text into a variable seems burdensome.

This code might also be handy to be sure that the signature block doesn’t get inserted multiple times. Thanks for whatever you can suggest.