Often you have the problem that the interaction has not been assigned to the right contact because you don’t have a unique interaction contact ID (such as a shared email address) in the interactions to be imported. But you have a unique custom or standard ID and you are able to assign it to the contacts. Let’s assume this contact import step has been finished and your contacts have a unique custom ID assigned.
Here are the steps how you can assign the interaction to the contact:
There are two options:
1. You are always able to send the unique ID with interactions.
1. Create a custom field for the unique ID
2. Ensure that the custom field will be filled when sending the interaction
3. In BAdI Revise Interaction Data Before Import (CUAN_IA_REVISE_FOR_IMPORT) make the contact changeable when specific interaction types are imported(example)
if interaction_data-ia_type = if_cuan_ce_c=>co_iatype_mkt_perm_optin or
interaction_data-ia_type = if_cuan_ce_c=>co_iatype_mkt_perm_optout or
interaction_data-ia_type = if_cuan_ce_c=>co_iatype_newsl_subscr or
interaction_data-ia_type = if_cuan_ce_c=>co_iatype_newsl_unsubscr.
interaction_data-ic_update_mode = if_cuan_ce_c=>co_ic_delta_update.
endif.
4. In BAdI “Review imported Interaction” update an Interaction Contact (CUAN_IMPORT_IA_4_IC) by adding the ID from the custom field to the contact (example: origin = SAP_ERP_BUPA, Custom field = mybupaid, the technical name of this field looks like this: yy1_mybupaid_mia)
DATA ls_add_facet LIKE LINE OF additional_facet.
IF contact_data-yy1_mybupaid_mia IS NOT INITIAL.
ls_add_facet-id = contact_data-yy1_mybupaid_mia.
ls_add_facet-id_origin = if_cuan_ce_c=>co_origin_sap_erp_bupa.
APPEND ls_add_facet TO additional_facet.
ENDIF.
5. The contact determination will be executed automatically
2. You want to use standard interaction fields or customer extension fields to find the correct contact
1. In BAdI Revise Interaction Data Before Import (CUAN_IA_REVISE_FOR_IMPORT) you can search for the correct contact using CDS views based on field which are available. You have to enrich the data with the contact key found (example search: origin = SAP_ERP_BUPA, Custom field = mybupaid)
select single interactioncontact from i_mkt_contactfacet into @interaction_data-contact_key
where InteractionContactOrigin = @if_cuan_ce_c=>co_origin_sap_erp_bupa and
InteractionContactId = @interaction_data-yy1_mybupaid_mia.
2. Please consider that at this point (when importing interactions via OData) no standard contact fields such as the Name fields are available. But you can use the same logic as above using extension fields. All custom fields will be available.