This topic contains 3 replies, has 0 voices, and was last updated by errol 8 years ago.

  • Author
    Posts
  • #6201 Score: 0

    jmessersmith
    • Contributions: 0
    • Level 1

    Code:
    nlapiSubmitField(‘salesorder’, searchresults[i].getId(), ‘custbodytracking_delivery_date’, nlapiStringToDate(’01/01/2011′));
    Is there a way to use nlapiSubmitField to change a datetime field? I’m getting UNEXPECTED_ERROR.

    Is the only other option using record.setDateTimeValue?
    This is a cached copy. Click here to see the original post.

  • #6202 Score: 0

    jmessersmith
    • Contributions: 0
    • Level 1

    Nevermind, it was all a formatting problem. should be in this format: mm/dd/yyyy hh:mm:ss am|pm (for example, ‘09/25/2013 06:00:01 am’).


    david.smith replied on 08/18/2016, 09:23 AM: Careful because each user can set their preferences to a different date format. See the other comments below for using nlapiStringToDate.

  • #6203 Score: 0

    k_dunc
    • Contributions: 0
    • Level 1

    Just BTW, I think the issue probably was your use of nlapiStringToDate. It probably should have been nlapiDateToString.

  • #6204 Score: 0

    errol
    • Contributions: 0
    • Level 1

    k_dunc is right. Also, for datetime fields, you could use nlapiDateToString(new Date(), ‘datetimetz’); The datetimetz will format it to work with the datetime fields. If you leave that out, it will format for normal date fields.

You must be logged in to reply to this topic.