Home > CRM 2011, JScript > Update record using OData and JQuery in CRM 2011
  1. Charles
    April 15, 2013 at 12:51 PM

    Hi,

    How to set a DAte field in the account object?
    account.DateFieldName = ????;

    Thank You.
    Charles

  2. Charles
    April 15, 2013 at 12:54 PM

    Hi,

    Following to my previous post.

    How to set a DateTime field in the account object?
    account.DateTimeFieldName = ????;

    Thank You.
    Charles

    • April 15, 2013 at 5:17 PM

      You can set date field as below

      var myDate = new Date();

      myDate.setFullYear(1980, 12, 29);

      account.DateTimeFieldName= myDate;

      • Charles
        April 15, 2013 at 7:30 PM

        Thank you for your reply.

        I already tried it but it always giving me the following error on error function “Incorrect attribute value type System.Data.Services.Serializers.JsonReader+JsonObjectRecords” after trying the below:
        1. var myDate = new Date();
        myDate.setFullYear(1980, 12, 29);
        account.new_ApprovalDate = myDate;
        2. var myDate = new Date(Xrm.Page.getAttribute(“new_approvaldate”).getValue());
        account.new_ApprovalDate = myDate;
        3. account.new_ApprovalDate = Xrm.Page.getAttribute(“new_approvaldate”).getValue();

        after I used IE Developer Tool i noticed that the datetime field is always null {“new_ApprovalDate”:{}}

        any hints on this error?

        Thank you again.

  1. February 6, 2012 at 7:29 PM
  2. August 30, 2013 at 8:14 AM
  3. September 24, 2014 at 5:10 PM
  4. September 24, 2014 at 6:02 PM

Leave a comment