Connect IT: Sample mapping scripts that will send the email to multiple users

script

When working with email integration using Connect IT to send out the emails from SM, we have some situations that the email will contain many recipients. You can see in eventout table, the recipients will be divided by each semicolon (;). So in the mapping script of CIT scenario, we have to define the script to put each user to the TO field, so they can receive the email seperately. To do that, we have some sample scripts below:

 

1. First Script:
============================================
Dim TestStr as String
TestStr=LeftPart([evfields],”^”)
Dim count as Integer
count = CountOccurences(TestStr,”;”)

if count = 1 then
RetVal = LeftPart([evfields], “;”)

else
TestStr = “;” + TestStr
PifLogInfoMsg(TestStr)
Dim lRet as Long
Dim MyStr
DIM i as integer
FOR i=0 to count-1 step 1
MyStr=ExtractValue(TestStr, “;”)
lRet = PifSetStringVal(“TO(“&str(i)&”).Address”, ExtractValue(TestStr, “;”,0))
next
RetVal = lRet
PifLogInfoMsg(lRet)
PifLogInfoMsg(“End Loop”)
end if
============================================
2. Second script:
============================================
Dim TestStr as String
‘TestStr=”;” +LeftPart([evfields],”^”)
TestStr=LeftPart([evfields],”^”)
Dim count as Integer
count = CountOccurences(TestStr,”;”)
Dim lRet as Long
Dim MyStr
DIM i as integer
FOR i=1 to count step 1
MyStr=ExtractValue(TestStr, “;”)
PifLogInfoMsg(MyStr)
RetVal = PifSetStringVal(“To(“&str(i)&”).Address”, MyStr)
MyStr = rightpartfromleft(TestStr,”;”)
next
============================================
3. Third Script
============================================
dim strSource,result, address as string
dim i, count, tmp as integer
strSource = LeftPart([evfields], “ˆ”)
count = countvalues (strSource, chr(59))
for i = 0 to count – 1
tmp = instr (0, strSource, “;”)
if tmp = 0 then
result = strSource
retval = pifsetstringval (“To(” & i & “).Address”, result)
else
result = left (strSource, tmp – 1)
retval = pifsetstringval (“To(” & i & “).Address”, result)
strSource = rightpartfromleft (strSource , “;”)
end if
next i
============================================

HAVE FUN!!!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s