Try OpenEdge Now
skip to main content
Managed Adapters Guide
Email Managed Adapter : Sending messages to multiple recipients : Using a LIST dataslot in the Email Adapter : Mapping the Email Adapter in List mode
 
Mapping the Email Adapter in List mode
The following section describes how to define the dataslot mapping for an Email Adapter when the "To:" field of the Email Adapter is mapped to a LIST dataslot.
To map the Email adapter in List mode:
1. In the Message tab of the Dataslot Mapping dialog box, select the ADDRESSES LIST dataslot to supply values for the "To:" field.
Mapping the ADDRESSES LIST dataslot to the "To:" field ensures that when the Email adapter is invoked, it will switch to List mode, extracting single elements from all LIST dataslots sent to the message body.
2. In the Part 1: Velocity Template tab, define the dataslot mapping as below:
The ${NAME} variable will be mapped to the NAMES LIST dataslot. Because the adapter is in List mode, each time a message is sent, the corresponding element of the NAMES dataslot will be used.
The same procedure applies to the ${PRIZES} variable and associated parameter. Note, however, that while the NAMES dataslot was a LIST of Strings, the PRIZES dataslot is a LIST of Lists, so each time a message is sent, the ${PRIZES} variable will contain the List of prizes won by the given person.
Finally, the ${PHONE} variable is mapped to the PHONE dataslot. This is a simple CHARACTER dataslot and will be the same for each message.
If everything is as expected, when the adapter is invoked, Joe will receive the following message (refer to Table 13, for information on dataslot names, types, and values):
    Hello Joe,
    You just won the following:
    - 36in TV
    - satellite radio
    Please, call (408) 555-1234 to claim your prize.
Jeff, on the other hand, will see the following email:
    Hello Jeff,
    You just won the following:
    - a penny
    - a dime
    - and a quarter!
    Please, call (408) 555-1234 to claim your prize.
Note that all this is possible only when the Email Adapter is invoked in List mode, i.e., when a LIST dataslot is mapped to the "To:" field. If we had mapped this field to a CHARACTER dataslot containing a comma-separated list of e-mail addresses, the adapter would have still send a separate message to each recipient, but the message content would be exactly the same for all users. (In particular, this template would not have worked properly, because the entire lists, and not just the list elements, would be passed to the NAME and PRIZES variables).