Wednesday, February 27, 2013

RecipientBusComp

A lot has been written on CreateRequest Method for Outbound Communication Manager Business Service. Recently we faced strange issue where users were bombarded with multiple emails for single request. On searching the issue on web i discovered lot of instances where this issue has occurred but solution was not clearly provided. This issue occurs mainly because Recipient Groups are not properly set up or the relationship between Primary BC and Recipient BC is not correctly defined.In this post i will try to take a dig at some of the important parameters which can help you define recipient buscomp.

Consider a scenario where you have a Service Request and multiple contacts associated to it with multiple roles. Now on status change mail should trigger to all contacts associated to Service Request and in some cases only to contacts with specific roles.

One can achieve the same without creating custom Recipient Groups with help of Recipient BusComp and Recipient Search Spec parameter.If one has good understanding of recipient groups i will still recommend go with that approach. However to use "TestAddress" parameter is not a good idea here because it overrides recipient's email address and will send multiple emails to the email defined in TestAddress. If you are using TestAddress with Recepient BusComp parameter, then ensure that only one record is returned in Recipient Buscomp. If there are multiple candidates in the Recepient Buscomp, multiple emails will be sent to TestAddress. Using TestAddress will ignore the value returned by Recipient Email Address Field user property in Recipient Buscomp.

In order to implement the above scenario, you have to consider following parameters of CreateRequest Method.

1 - CommProfileOverride
This is the name of profile used for communication

2 - PackageNameList
This is the name of template which is used for field substitution

3 - SourceIdList
Semicolon-delimited list of IDs. These Ids are used for record substitution for the BC defined in the Template.

4 - SourceBusObj
Name of the business object. This is very important in order to determine the link between primary Bc and Recipient BC. Service Request in this Case.

5- RecipientBusComp
Name of the Business component which contains recipient records. In this case it has to be business component based on the inter table between Servcie Request and contact. Email will be sent to associated contacts to the value returned by Recipient Email Address user property in recipient business component. In this case it is Service Request Contact BC.

6 - RecipSearchSpec
This parameter can you used to filter recipients. We can filter record based on the role to send email to specific person.

7- TestAddress
If Recipient Email Address Field user property is not defined and email needs to be sent to particular email id. However make sure Recipient BC always returns one record.
Using these parameters one can control email flow dynamically. Any comments and suggestion on usage of this method is useful.

Happy Mailing!!