2

We have setup MC Connect for integrating our Sales Cloud instance and SFMC instance. We have configured Triggered Sends for CampaignMember object in Sales Cloud (using the Trigger as suggested by MC Documentation here).

As per the requirement we have to add a link to a VF page dynamically (using the parameters ContactID, CampaignId and a custom field from Contact) on the email which will be sent as part of the Triggered Send.

The challenge that we face is we can't access the runtime object information (which initiated the Triggered Send, in this case information related to the CampaignMember object like ContactId/CampaignId) due to which we can't build the URL. All we have access to is Subscriber Key which is the ContactID for CampaignMember object record which initiated the Send.

Is there anyway we can access the information related the object which initiates the Triggered Send ?

Thanks Nikhil

2
  • I just tried and edited the AMPScript code and could access the Standard Fields on the CampaignMember object, however now I can't seem to get the value out of a custom field which is of type Formula (Text). Commented Jun 24, 2017 at 15:15
  • I thought that AMPscript might not be able to extract value from a formula Custom Field so I created a text field and got it populated using a workflow rule but AMPscript couldn't even access that. Commented Jun 25, 2017 at 8:27

1 Answer 1

1

This is a great question. There are a few of solutions that I can think of:

1. Journey Builder

If Journey Builder is enabed on your account then you could create a Journey with a Salesforce Data Event.

From your email, you could then retrieve other Attributes that you defined in your event using the RetrieveSalesforceObjects() AMPscript function using colon notation as detailed in this answer.

2. Add Subscriber Profile Attributes

A Triggered Send request from Sales Cloud uses Marketing Cloud's messageDefinitionSends REST API method. REST API method. It turns out that several other fields are included in the request payload.

If you review the Triggered Send logs in Sales Cloud, you will see the raw payload request made to Marketing Cloud. Logs are located under Documents tab in Sales Cloud, under Marketing Cloud Documents folder:

*****2017-06-25 23:01:49.991|LOG STARTED
*****2017-06-25 23:01:49.991|HTTP CALLOUT|SingleSyncSubscriber
*****2017-06-25 23:01:50.69|HTTP REQUEST|https://rest.s7.exacttarget.com/rest/beta/integration/subscriber/synchronization/single/ {"source":{"salesforce":{"version":"5.0","subscriber":{"type":"contact","key":"00328000016OkOOAA0"},"properties":[{"value":"false","name":"HonorEmailOptOut"}],"channel":"Email"}}}
*****2017-06-25 23:01:50.88|HTTP RESPONSE|{"hasWarnings":false,"subscriberData":[{"name":"Id","value":"00328000016OkOOAA0"},{"name":"EmailAddress","value":"[email protected]"},{"name":"SFOrgId","value":"00D28000001HqWBEA0"},{"name":"AlternateKey","value":"00328000016OkOOAA0"},{"name":"Email Address","value":"[email protected]"},{"name":"First Name","value":"Test"},{"name":"Last Name","value":"sam3"},{"name":"Organisation","value":"sam2 and sam3 Household"},{"name":"Diagnosis","value":"false"},{"name":"Biobank","value":"false"}],"hasError":false}
*****2017-06-25 23:01:50.905|HTTP CALLOUT|ExecuteTriggeredSend
*****2017-06-25 23:01:50.923|HTTP REQUEST|https://www.exacttargetapis.com/messaging/v1/messageDefinitionSends/7eadead7-8651-e711-8a02-1402ec67ad30/send {"From":{"Address":null,"Name":null},"To":{"Address":"[email protected]","SubscriberKey":"00328000016OkOOAA0","ContactAttributes":{"SubscriberAttributes":{"EmailAddress":"[email protected]","SFOrgId":"00D28000001HqWBEA0","AlternateKey":"00328000016OkOOAA0","Email Address":"[email protected]","First Name":"Test","Last Name":"sam3","Organisation":"Acme LLC","Diagnosis":"false","Current":"false","SObject":"CampaignMember","RecordId":"00v28000009MRapAAG"}}}}
*****2017-06-25 23:01:50.937|HTTP RESPONSE|{"requestId":"250ff420-845a-4016-a09e-d9691c228365","responses":[{"recipientSendId":"250ff420-845a-4016-a09e-d9691c228365","hasErrors":false,"messages":["Queued"]}]}

If you inspect the Subscriber Attributes object, you will see the attributes that are passed to Marketing Cloud by the Triggered Send. You can then create nullable Subscriber Attributes in Marketing Cloud (Email App > Subscribers > Profile Management) with matching names and the values will be stored agains the subscriber, which can then be retrieved using AMPscript in your email. For example:

set @recordId = AttributeValue('RecordId')

3. Triggered Send REST API

The other option would be to use the HttpRequest Apex Class to make a request to Marketing Cloud's messageDefinitionSends REST API method.

You would first need to create a Data Extension using the 'Create From Template' option and selecting the 'TriggeredSendDataExtension' template. Add the fields that you want to capture from your Trigged Send, for example: CampaignId, HasResponded, etc.

Then, when you create your Triggered Send in Marketing Cloud, in the Subscriber Management section, uncheck the 'Add Subscribers to this list' option list and select the "Triggered Send" Data Extension that you created.

Subscriber Management

When a triggering API request is made, a row is added to the Triggered Sends DE for each recipient contained in the request. Note that your SubscriberAttributes must include all required fields of the data extension that don't have a default value.

In your email, you can then use the Lookup or LookupRows AMPscript functions to retrieve the values from the Triggered Send DE you created.

Here's a sample request payload for your messageDefinitionSends request:

{  
   "From":{  
      "Address":"[email protected]",
      "Name":"no reply"
   },
   "To":{  
      "Address":"[email protected]",
      "SubscriberKey":"00330000000xEftMGH",
      "ContactAttributes":{  
         "SubscriberAttributes":{  
            "CampaignId":"00330000000xEftmgh",
            "HasResponded":true,
            "FirstName":"Simon",
            "LastName":"Sausage",
            "LeadOrContactId":"001000000000AbCd"
         }
      }
   }
}
2
  • Thanks for your answer Eliot. I shall try and let you know shortly. Commented Jun 25, 2017 at 9:30
  • added Subscriber Profile Attributes answer Commented Jun 25, 2017 at 21:28

You must log in to answer this question.

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