5 Replies Latest reply on Aug 4, 2017 11:55 AM by Eric Larson

    Datetime field issue in leadchanges.json

    Eric Larson

      I am using REST API to get the list of updated lead activities. Few of the fields I'm monitoring are 'datetime' format and they seem to return a wrong time.

       

      Here are more info:

       

      Request URL: /rest/v1/activities/leadchanges.json

       

      Result Response:

      {

        "requestId": "d94a#15daa2224bf",

        "result": [

          {

            "id": 111

            "marketoGUID": "111",

            "leadId": 111,

            "activityDate": "2017-08-03T22:05:21Z",

            "activityTypeId": 13,

            "fields": [

              {

                "id": 111,

                "name": "dateTimeField",

                "newValue": "2017-08-10 16:00:00", // set to 2 PM

                "oldValue": "2017-08-10 15:00:00"   // set to 1 PM

              }

            ],

            "attributes": [...]

            ]

          }

        ],

        "success": true,

        "nextPageToken": "====",

        "moreResult": false

      }

       

      When I set the field value to 2 PM, 16:00:00 is returned. The REST response is consistently 2 hours offset. Have anyone come across this and found out the reason why?

        • Re: Datetime field issue in leadchanges.json
          Sanford Whiteman

          What time zone are you in?

          • Re: Datetime field issue in leadchanges.json
            Takehiro Masaki

            Hi Eric Larson

            I found it's simple reason.

            - Set {{system.Datetime}} to testDtetime.

            - My timezone is +9:00

            Response

               "requestId":"76e8#15dab864618",

               "result":[ 

                  { 

                     "id":143508,

                     "marketoGUID":"143508",

                     "leadId":1011725,

                     "activityDate":"2017-08-04T04:21:14Z",

                     "activityTypeId":13,

                     "campaignId":2627,

                     "fields":[ 

                        { 

                           "id":942,

                           "name":"testDatetime",

                           "newValue":"2017-08-03 23:21:14",

                           "oldValue":null

                        }

                     ],

                     "attributes":[ 

                        { 

                           "name":"Reason",

                           "value":"Changed by Smart Campaign 20170804 DateTime Change.ChangeSC action Change Data Value"

                        }

                     ]

                  }

               ],

               "success":true,

               "nextPageToken":"B2PLOCQQCZENKEARIRSIVWGHMVX376VHYDXP5N4Q3A4RZ7LCKXSQ====",

               "moreResult":false

            }

            Important thing is  "newValue" and "oldValue" is NOT W3C Datetime Format.

            These types are String.

            I think it's Marketo internal timezone +5:00 -5:00

            {"id":13,"name":"Change Data Value","description":"Changed attribute value for a person/record","primaryAttribute":{"name":"Attribute Name","dataType":"integer"},

            "attributes":[

            {"name":"New Value","dataType":"string"},

            {"name":"Old Value","dataType":"string"},

            {"name":"Reason","dataType":"string"},

            {"name":"Source","dataType":"string"}

            ]},

            1 of 1 people found this helpful