6

I'm doing a custom activity and would need to be able to get the value of any field of the data extension input in the journey.

At this moment my custom activity is prepared to receive the value of the fields of any data extension that is put in the journey entry but necessarily those fields have to have the same name.

This is how I do it:

connection.on('requestedTriggerEventDefinition',
function(eventDefinitionModel) {
    if(eventDefinitionModel){
       eventDefinitionKey = eventDefinitionModel.eventDefinitionKey;
    }
});

And in function save:

toJbPayload['arguments'].execute.inArguments.push({"Field1":"{{Event." + 
eventDefinitionKey + ".\"Field1\"}}"});
toJbPayload['arguments'].execute.inArguments.push({"Field2":"{{Event." + 
eventDefinitionKey + ".\"Field2\"}}"});
toJbPayload['arguments'].execute.inArguments.push({"Field3":"{{Event." + 
eventDefinitionKey + ".\"Field3\"}}"});
toJbPayload['arguments'].execute.inArguments.push({"Field4":"{{Event." + 
eventDefinitionKey + ".\"Field4\"}}"});

I would appreciate it if anyone knew how to pick up any field of any data extension that got into the entry of the journey.

Thanks.

  • 2
    It is a bit frustrating that the notify on a custom activity seemingly cannot just send a payload with all pertinent data for the contact flowing in. I have resolved your issue by requiring mapping to the Data Extension on the Activity's canvas, storing mapping, then retrieving via Soap based upon mapping using Contact.Key upon notify. This comes with its own potential issues, but it is working thus far. Documentation on custom activity notify payloads and such is rather thin. – Mike Aug 8 '18 at 13:56
  • Thanks, I'll prove it. From your experience with a high volume of records and making the corresponding SOAP calls is the activity efficient? – Alejandro Barchino Navarro Aug 9 '18 at 14:43
  • It depends upon how the application handling the notify events is architected. Making a SOAP call real-time as notify events come in probably is not the best approach, especially if you are receiving a large volume of notifys in a small time frame, but you can certainly queue things up as they come in then make the SOAP calls in some backend process. Creating your SOAP calls with proper filters and such will also go a long way to improve efficiency. – Mike Aug 9 '18 at 15:10
0

You have three options here

1) Use Entry Events which contain a schema (were created via API) - These contain the data extension fields in the Event Definition. More information on this here: https://developer.salesforce.com/docs/atlas.en-us.noversion.mc-apis.meta/mc-apis/event-definition-schema.htm

2) Use SOAP - the Data Extension Object (https://developer.salesforce.com/docs/atlas.en-us.noversion.mc-apis.meta/mc-apis/dataextension.htm) has a property with Fields which you could access.

3) Use the Internal API - THIS IS NOT SUPPORTED BUT WORKS - There are many internal APIs in Marketing Cloud (often replacing the SOAP Calls) which can only be accessed by a system token - The token you get in the Custom Activity is one of these tokens.

Something like the following (keep in mind your instance may not be S7) should get you a JSON of the fields
GET /internal/v1/customobjects/DATA-EXTENSION-ID-HERE/fields HTTP/1.1 Host: www-mc-s7.exacttargetapis.com Accept: application/json, text/javascript, */*; q=0.01 authorization: Bearer JB-TOKEN-HERE Content-Type: application/json Cache-Control: no-cache

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.