0

I am working on my first use of custom activity in Journey builder where, I need to access the values of the fields from Data Extension as inArguments. We used the below syntax to pass the input parameter to call the Custom activity.

{{Contact.Attribute.DE_NAME.Name}}

But issue is, If will use the above syntax so have to use the same DE_name time as static. But in our use case we have to create the separate Journey every time with different data extensions as entry source. Is there any way to call the custom activity with different data extensions as entry source to pass the input parameters.

  • Did you check this answer salesforce.stackexchange.com/a/221888/47806 ? – Ros Haitovich Nov 21 '19 at 6:31
  • @RosHaitovich Thank for connecting. We were trying this solution only but seems not able to fetch the DE name. Input parameter are coming null. Just FYI please, we are using data extension as entry source so could you please help how we can fetch the DE name dynamically in custom activity. – A Vashisth Nov 26 '19 at 2:12
  • i am using this solution to retrieve data dynamically from deferent sources including DE entry source. – Ros Haitovich Nov 26 '19 at 11:56
  • Payload will looks like // Event.DEAudience // {"key":"Event.DEAudience-c4c57750-072a-2471-a388-8f27b56d6b14.AccountId","type":"Text", // "length":"18","default":null,"isNullable":null,"isPrimaryKey":null} – Ros Haitovich Nov 26 '19 at 12:02
  • 1
    @RosHaitovich- Thank you for you kind assistance. We are able to use the schema and can pass the inputs from multiple DEs. However, we didn't use the loop but its working fine. Thank you again. – A Vashisth Dec 3 '19 at 1:11
1

Once you have schema, extract fields and update inArguments property.
Please check following example how to update custom activity configuration to support dynamic binding.

// Save arguments and update journey builder
function save() {
  console.log("*** saving arguments ***");

  // remove all the args, only save the last one
  inArgPayload["arguments"].execute.inArguments = [];

  // retrieve and push all of the form names / values into the args stack
  inArgPayload["arguments"].execute.inArguments.push(_this.state.formData);

  // add data from schema
  // dynamic binding
  var formArg = {};
  console.log("*** Schema parsing ***", JSON.stringify(schema));
  if (schema !== "undefined" && schema.length > 0) {
    // the array is defined and has at least one element
    for (var i in schema) {
      var field = schema[i];
      var index = field.key.lastIndexOf(".");
      var name = field.key.substring(index + 1);

      if (
        field.key.indexOf("Event.APIEvent") !== -1 ||
        field.key.indexOf("Event.SalesforceObj") !== -1 ||
        field.key.indexOf("Event.DEAudience") !== -1
      )
        formArg[name] = "{{" + field.key + "}}";
    }
    // must be set to true for the journey to recognize
    // the activity as fully configured (required for activation)
    inArgPayload.metaData.isConfigured = true;
    inArgPayload["arguments"].execute.inArguments.push(formArg);
  }

  connection.trigger("updateActivity", inArgPayload);
  //
  console.log("saved payload ", JSON.stringify(inArgPayload));
}}
| 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.