This topic contains 9 replies, has 0 voices, and was last updated by starlingMark 7 years ago.

  • Author
    Posts
  • #1106 Score: 0

    starlingMark
    • Contributions: 0
    • Level 1

    I’m running a User Event script with a before submit trigger on a Work Order. I am grabbing some info from one of the items in the sublist and then populating a few custom body fields. In particular, I’m populating a custom field of type integer.

    When I run the script through the UI everything works as expected. However, if i perform an nlapiSubmitField from the console, I get the error:

    INVALID_FLD_VALUE – You have entered and Invalid Field Value 1000.0 for the following field: custbody_quantity

    I have tried everything I can think of to try and get the thing to submit properly. I’ve tried:using parseInt on my original value
    using toString on my original value
    using format.format({ value: myValue, type: format.Type.INTEGER })
    using a hard-coded integer value
    And everything fails – but ONLY from the console.

    I even tried running the script through the Script Debugger. If I trigger it through the UI it walks through the script and executes properly. If I trigger it via the console, the debugger crashes my browser without ever showing a line of code.

    Also, I thought that when you issued this type of command from the console the event type was XEDIT. However, the first line of my beforeSubmit trigger is an execution log that is reporting the event type as EDIT.

    I’m looking to you, oh wise keepers of the SS2.0 faith. Bestow your genius upon me!
    This is a cached copy. Click here to see the original post.

  • #1107 Score: 0

    starlingMark
    • Contributions: 0
    • Level 1

    I guess this is not a common issue. I will try paging chanarbon – any suggestions?

  • #1108 Score: 0

    jejacob
    • Contributions: 0
    • Level 1

    Hi starlingMark,

    Have you tried refreshing the page? I tried to reproduce the problem:

    1. Create custom body field with type: integer

    2. Create a work order

    3. Expose browser console then invoke:

    Code:
    nlapiSubmitField(‘workorder’, ‘6783’, ‘custbody24’, 8);
    4. Refresh the work order record

    Result: it was updated correctly without error.

  • #1109 Score: 0

    michoel
    • Contributions: 0
    • Level 1

    Originally posted by starlingMark

    View Post

    Also, I thought that when you issued this type of command from the console the event type was XEDIT. However, the first line of my beforeSubmit trigger is an execution log that is reporting the event type as EDIT.!

    This might be due to the field not actually being ‘Inline Editable’, in which case nlapiSubmitField() will perform a regular edit instead:

    Although nlapiSubmitField(…) is the programmatic equivalent of inline editing, it is possible to use this API to update fields that are not inline editable in the UI. If a non inline editable field is submitted for update, all the data on the record will be updated appropriately. However, to support this, when a non inline editable field is submitted, the NetSuite backend must load the record, set the field(s), and then submit the record. Completing the “load record, set field, submit record” lifecycle for a record allows all slaving and validation logic on the record to execute.

    (https://system.netsuite.com/app/help…_N2954353.html)

  • #1110 Score: 0

    starlingMark
    • Contributions: 0
    • Level 1

    jejacob Thanks for the suggestion – but no luck. The record does not commit the changes due to the error message.

    michael Thanks for that tidbit – added to my toolbox!

    In all of the combinations I’ve tried I log out the value and it always displays as 1000 in the execution log. However the error always says that I’m trying to set “1000.0”. Still works in the UI, still breaks in the console.

  • #1111 Score: 0

    starlingMark
    • Contributions: 0
    • Level 1

    I’ve also just tried stripping the script down to exactly this:

    Code:
    function beforeSubmit(scriptContext) {
    scriptContext.newRecord.setValue({
    fieldId: ‘custbody_quantity’,
    value: format.format({ value: 999, type: format.Type.INTEGER })
    });
    }
    I get the same error – You have entered an Invalid Field Value 999.0 for the following field: custbody_quantity.

    Still works in the UI, still errors out in the console. Argh.

  • #1112 Score: 0

    chanarbon
    • Contributions: 0
    • Level 1

    Hi starlingMark

    I would first suggest for you to get the field type by loading the record then .getField() then .getType(). From there you may isolate the formatting that the format module that you would try. Another thing, do you have any other scripts deployed on the workorder which might have triggered on XEDIT event and caused the INVALID_FLD_VALUE.

  • #1113 Score: 0

    starlingMark
    • Contributions: 0
    • Level 1

    chanarbon – Good suggestion. I did try that earlier this morning and here is what I got for the field:

    Code:
    {“id”:”custbody_quantity”,”label”:”Formula Quantity”,”type”:”integer”}
    There are also no other scripts or workflows running on this record.

    Keep those ideas coming!

  • #1114 Score: 0

    david.smith
    • Contributions: 0
    • Level 1

    try your value as a string.

    Code:
    function beforeSubmit(scriptContext) {
    scriptContext.newRecord.setValue({
    fieldId: ‘custbody_quantity’,
    value: ‘999’
    });
    }

  • #1115 Score: 0

    starlingMark
    • Contributions: 0
    • Level 1

    Good suggestion – but same error.

You must be logged in to reply to this topic.