Accessing Data Extension field values – Journey builder custom activity

I am working on custom activity in Journey builder where, I need to access the values of the fields from Data Extension as inArguments. I read about data binding from here and used the below syntax to access data extension field values:

{{Contact.Attribute.DE_NAME.FirstName}}

But, I receive empty string in the FirstName field and I am sure there is value present for this field in DE.

config.json

{
  "workflowApiVersion": "1.1",
  "metaData": {
    "icon": "img/img_1.png",
    "iconSmall": "img/img_2.png",
    "category": "message"
  },
  "type": "REST",
  "lang": {
    "en-US": {
      "name": "Test custom activity",
      "description": "Testing custom activity"
    }
  },
  "arguments": {
    "execute": {
      "inArguments": [
        {
          "firstName": "{{Contact.Attribute.DE_NAME.FirstName}}"
        },
        {
          "lastName": "{{Contact.Attribute.DE_NAME.LastName}}"
        },
        {
          "emailAddress": "{{Contact.Default.Email}}"
        }
      ],
      "outArguments": [],
      "url": "https://xyz.ngrok.io/activities/execute",
      "verb": "POST",
      "body": "",
      "header": "",
      "format": "json",
      "useJwt": false,
      "timeout": 10000
    }
  },
  "configurationArguments": {
    "applicationExtensionKey": "test-activity-custm-wwq",
    "defaults": {
      "activity": "0"
    },
    "save": {
      "url": "https://xyz.ngrok.io/activities/save",
      "useJwt": false
    },
    "publish": {
      "url": "https://xyz.ngrok.io/activities/publish",
      "verb": "POST",
      "body": "",
      "useJwt": false
    },
    "validate": {
      "url": "https://xyz.ngrok.io/activities/validate",
      "verb": "POST",
      "body": "",
      "useJwt": false
    },
    "stop": {
      "url": "https://xyz.ngrok.io/activities/stop",
      "useJwt": false
    }
  },
  "wizardSteps": [
    {
      "label": "Select anything",
      "key": "1"
    },
    {
      "label": "Confirm Settings",
      "key": "2"
    },
    {
      "label": "Save Settings",
      "key": "3",
      "active": false
    }
  ],
  "userInterfaces": {
    "configModal": {
      "height": 250,
      "width": 600,
      "fullscreen": false
    }
  }
}

Received inArguments in Execute API :

{"inArguments"=>[{"firstName"=>""}, {"lastName"=>""}, {"emailAddress"=>"<a href="https://getridbug.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="b9cddccacddcd4d8d0d5928f8bf9ded4d8d0d597dad6d4">[email protected]</a>"}]

Is anything I am doing wrong, please help me.

Thanks..

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

If those values are part of the entry event, you can access them using the following expression:

{{Event.<YOUR ENTRY EVENT DEFINITION KEY>."<EVENT DATA ID PATH>"}}

If not, you need to link the data extension correctly to an attribute group in contact builder, for it to be available for data binding in the arguments of your custom activity. In that case your expression is correct.

Related documentation:

Code Example:


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x