4

Due to compliance reasons, I'm required to BCC an archive email address for each SFMC send. I have below code snippet in one of the emails.

SET @caseCreate = CreateSalesforceObject(
    'CaseComment', 3,
    'ParentId', AttributeValue('CaseId'),
    'CommentBody', Concat('Email #', AttributeValue('CaseIndex'), ' sent.'),
    'IsPublished', 'false'
)

It executes correctly. Unfortunately, because there is a BCC address attached, SFMC actually sends 2 emails and both of them log same comment. I'm looking for a condition in Ampscript that will allow me to limit code execution and exclude this operation for BCC send, so that only 1 record gets created. I'd rather avoid searching SF with RetrieveSalesforceObjects() beforehand, I'd prefer something based on personalization string. I've tried below, but they don't seem to work. Is there any way to actually achieve that and distinguish these?

AttributeValue('emailaddr') == '[email protected]' // for bcc send this resolves to subscriber email
AttributeValue('_messagecontext') != 'SEND' // is 'SEND' for bcc send as well
0

1 Answer 1

1

There is AFAIK no personalisation string which could tell you about the email being sent in a bcc context. Could you build a logging data extension, with following columns: CaseID (PK), JobID(PK), Timestamp - this will allow you to lookup, prior to executing CreateSalesforceObject function, whether a comment has been created for this case. Setting aggressive data retention on this DE, in addition to making both columns PK (this will add index to these fields in the table) will ensure an acceptable performance.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .