This topic contains 3 replies, has 0 voices, and was last updated by j.j 7 years, 5 months ago.

  • Author
    Posts
  • #21590

    MarkZSSI

    I'm trying to set a checkbox and everything in the scheduled script works fine when testing it by writing to the screen.

    In testing the code – This works:

    Code:
    response.write("n" + "check that box" + "n");
    When I tried to push as a live schedule in our sandbox – This does NOT work:

    Code:
    nlapiSetFieldValue('custbody_a1wms_dnloadtowms', 'T');
    Any ideas on how to get the checkbox to check when the write to screen works fine using the same testing to write that statement.
    This is a cached copy. Click here to see the original post.

  • #21591

    MarkZSSI

    Nevermind. I figured it out. Scheduled scripts make you go through the whole load record and submit record stuff. ie:

    Code:
    var order = nlapiLoadRecord('salesorder', it);
    order.setFieldValue('custbody_a1wms_dnloadtowms', 'T');
    nlapiSubmitRecord(order, true);

  • #21592

    erictgrubaugh

    `nlapiSetFieldValue` would not be applicable in a Scheduled Scripts as there is no record in the global context. That would only work in a User Event, Client Script, or Workflow Action that is associated to a specific record type. In a Scheduled Script, you will need to be loading or creating a record, then use record.setFieldValue`


    MarkZSSI replied on 06/08/2017, 03:32 PM: Yes, I figured it out. See above. And thanks for responding!

  • #21593

    j.j

    i would suggest using nlapisubmitfield – this would save you from loading and submitting the entire record.

You must be logged in to reply to this topic.