SOLVED

Re: Datetime field type in custom activity

Go to solution
alexis_lewalle
Level 1

Datetime field type in custom activity

Hi everyone!


I have a question about a datetime field on a custom activity. I would like to push a custom activity but I'm facing a problem: what must be the type of a datetime?

I've tried a lot of things but nothing works:

 

"2020-07-16T10:51:58-04:00" (iso 8601, suggested here: https://developers.marketo.com/rest-api/lead-database/fields/field-types/)

"2020-07-16T10:51Z"

"2020-07-16T10:51:58Z"

"07/16/2020 10:51:58" (suggested here: https://nation.marketo.com/t5/Knowledgebase/Marketo-Field-Limits-by-Field-Type/ta-p/251613)

Here is the return error I got from the API:

 

{
   "requestId"=>"ab31#173907cf501",
   "result"=> [
      {
         "status"=>"skipped", 
         "errors"=> [
            {
               "code"=>"1003", 
               "message"=>"Invalid attribute 'interactionDate'"
            }
         ]
      }
   ], 
   "success"=>true
}

 

 

I checked in the admin part, but the field is called interactionDate (I tested with other names and it doesn't change anything, I still have the same error)

 

Does someone have an idea?

 

Thank you all!

1 ACCEPTED SOLUTION

Accepted Solutions
alexis_lewalle
Level 1

Re: Datetime field type in custom activity [EDIT: api field name wasn't correct]

Hello again,

 

After looking on the internet, I finally found my problem... This post helps me: post

My problem wasn't related to the "datetime" format... but the filed name that I used when I did the call!
I don't understand why they called it "apiName" and we have to use the "name"??

 

In my case, I used "interactionDate" (apiName) instead of "Interaction Date" (name)...
When I set "Interaction Date" with this DateTime value "
2015-07-20T12:30:00-08:00", it works like a charm!

But it will remain a mystery to me...

 

Again, thank you for your help! Have a good one

View solution in original post

4 REPLIES 4
Tracey_Bartz1
Level 5

Re: Datetime field type in custom activity

This might be a silly question but are you sure the field type is datetime and not just date?

Darshil_Shah1
Level 10 - Community Advisor + Adobe Champion

Re: Datetime field type in custom activity

Yes Tracey's concern is right. This happened to me few weeks back, I was setting the attribute to datetime value instead of date only value and it was throwing an error, as soon I used the Date only format (YYYY-MM-DD) it worked like charm. 

alexis_lewalle
Level 1

Re: Datetime field type in custom activity

Hi everyone, sorry for my late response, and thank you for your replies!

 

I did some tests.

 

Here with the datetime test.

In my custom activity:

Screenshot 2020-09-24 at 10.52.25.png

 The body I send:

{
    "input": [
        {
            "activityDate": "2020-09-23T15:57:36+00:00",
            "activityTypeId": 100001,
            "attributes": [
              {
                "name": "type",
                "value": "Live Chat"
              },
              {
                "name": "interactionDate",
                "value": "2020-09-23T15:57:36+00:00"
              },
              {
                "name": "description",
                "value": "Had a conversation with blablabla"
              }
            ],
            "leadId": 26,
            "primaryAttributeValue": "26-2020-09-23T15:57:36+00:00"
          }
    ]
}

the response I get:

{
    "requestId": "3072#174bf4fc8f6",
    "result": [
        {
            "status": "skipped",
            "errors": [
                {
                    "code": "1003",
                    "message": "Invalid attribute 'interactionDate'"
                }
            ]
        }
    ],
    "success": true
}

 

I did a test with the date format which didn't work either...

Screenshot 2020-09-24 at 11.05.26.png

{
    "input": [
        {
            "activityDate": "2020-09-23T15:57:36+00:00",
            "activityTypeId": {{activity_id}},
            "attributes": [
              {
                "name": "type",
                "value": "Live Chat"
              },
              {
                "name": "description",
                "value": "Had a conversation with blablabla"
              },
              {
                  "name": "interactionDate",
                  "value": "2020-09-23"
              }
            ],
            "leadId": {{marketo_id}},
            "primaryAttributeValue": "{{marketo_id}}-2020-09-23T15:57:36+00:00"
          }
    ]
}
{
    "requestId": "48f4#174bf5b1983",
    "result": [
        {
            "status": "skipped",
            "errors": [
                {
                    "code": "1003",
                    "message": "Invalid attribute 'interactionDate'"
                }
            ]
        }
    ],
    "success": true
}

 

Did I miss something? I really need this attribute, in the datetime format if it's possible...

Thank you for your help!

alexis_lewalle
Level 1

Re: Datetime field type in custom activity [EDIT: api field name wasn't correct]

Hello again,

 

After looking on the internet, I finally found my problem... This post helps me: post

My problem wasn't related to the "datetime" format... but the filed name that I used when I did the call!
I don't understand why they called it "apiName" and we have to use the "name"??

 

In my case, I used "interactionDate" (apiName) instead of "Interaction Date" (name)...
When I set "Interaction Date" with this DateTime value "
2015-07-20T12:30:00-08:00", it works like a charm!

But it will remain a mystery to me...

 

Again, thank you for your help! Have a good one