Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8953307
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T14:04:10+00:00 2026-06-15T14:04:10+00:00

I have the following to update a record: var currentTimeBeingTracked = getCurrentTimeTracked(); if (currentTimeBeingTracked

  • 0

I have the following to update a record:

var currentTimeBeingTracked = getCurrentTimeTracked();

if (currentTimeBeingTracked != null) {
    currentTimeBeingTracked.dagency_EndDateTime = new Date();

    var jsonTrackedTime = window.JSON.stringify(currentTimeBeingTracked);

    $.ajax({ type: "POST",
        contentType: "application/json; charset=utf-8",
        datatype: "json",
        url: ODataPath + "/dagency_trackedtimeSet",
        data: jsonTrackedTime,
        beforeSend: function (XMLHttpRequest) {
            XMLHttpRequest.setRequestHeader("Accept", "application/json");
        },
        success: function (data, textStatus, XmlHttpRequest) {
            var newTimeTracked = data.d;
            RetrieveTrackedTimes();
            alert("Stopped tracking your time successfully.");
            window.top.document.getElementById("contentIFrame").contentWindow.location.reload();
        },
        error: function (XmlHttpRequest, textStatus, errorThrown) {
            debugger;
            alert("Couldn't stop tracking your time. " + XmlHttpRequest.responseText);
        }
    });
}

But I keep getting this message:

Error processing request stream. Error encountered in converting the
value from request payload for property ‘CreatedOn’ to type
‘DateTime’, which is the property’s expected type. See inner exception
for more detail.

To create the record, I use the following code that works perfectly:

var trackedTime = new Object();

var timeEntryName = prompt("Please enter a name for the tracked time:", "New time entry");
if (!timeEntryName) {
    return false;
}

var isBillable = confirm("Is this task billable? If Yes, press OK.");

trackedTime.dagency_name = timeEntryName;
trackedTime.dagency_StartDateTime = new Date();
trackedTime.dagency_Billable = isBillable;

var slot = new Object();
slot.Id = crmForm.ObjectId;
trackedTime.dagency_Slot = slot;

var jsonTrackedTime = window.JSON.stringify(trackedTime);

$.ajax({ type: "POST",
    contentType: "application/json; charset=utf-8",
    datatype: "json",
    url: ODataPath + "/dagency_trackedtimeSet",
    data: jsonTrackedTime,
    beforeSend: function (XMLHttpRequest) {
        XMLHttpRequest.setRequestHeader("Accept", "application/json");
    },
    success: function (data, textStatus, XmlHttpRequest) {
        var newTimeTracked = data.d;
        RetrieveTrackedTimes();
        alert("Started tracking your time successfully.");
        window.top.document.getElementById("contentIFrame").contentWindow.location.reload();
    },
    error: function (XmlHttpRequest, textStatus, errorThrown) {
        alert("Couldn't start tracking your time. " + XmlHttpRequest.responseText);
    }
});

What is the problem? Where can I find the inner exception the message refers to?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T14:04:11+00:00Added an answer on June 15, 2026 at 2:04 pm

    Changed to this and it worked correctly:

    if (currentTimeBeingTracked != null) {
        var trackedTimeUpdated = new Object();
        trackedTimeUpdated.dagency_EndDateTime = new Date();
    
        var jsonTrackedTime = window.JSON.stringify(trackedTimeUpdated);
    
        $.ajax({ type: "POST",
            contentType: "application/json; charset=utf-8",
            datatype: "json",
            url: ODataPath + "/dagency_trackedtimeSet(guid'" + currentTimeBeingTracked.dagency_trackedtimeId + "')",
            data: jsonTrackedTime,
            beforeSend: function (XMLHttpRequest) {
                XMLHttpRequest.setRequestHeader("Accept", "application/json");
                XMLHttpRequest.setRequestHeader("X-HTTP-Method", "MERGE");
            },
            success: function (data, textStatus, XmlHttpRequest) {
                var newTimeTracked = data.d;
                RetrieveTrackedTimes();
                alert("Stopped tracking your time successfully.");
                window.top.document.getElementById("contentIFrame").contentWindow.location.reload();
            },
            error: function (XmlHttpRequest, textStatus, errorThrown) {
                debugger;
                alert("Couldn't stop tracking your time. " + XmlHttpRequest.responseText);
            }
        });
    }
    

    What was wrong was that I need to set the X-HTTP-Method to MERGE and specify the guid in the URL.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code: UPDATE myTable SET Col1 = @Value However, I have
I have tried the following MySQL update but it only sets the first field
For my test I have the following: test should update holder do holder =
I quite often have rows of code like the following: UPDATE my_table SET name
I have the following code: $SQL = UPDATE jobs SET read = '1' WHERE
I have been following the answer of this question: How to update existing object
I have the following SQL statement where i'm trying to update multiple rows matching
Currently I have to write the following to update an element already contained in
I have the following query: SET @q = 12; UPDATE `table` SET qty =
I have the folowing code to fetch a record and update one column which

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.