This topic contains 2 replies, has 0 voices, and was last updated by Jordan Manningham 7 years, 1 month ago.

  • Author
    Posts
  • #21445

    Jordan Manningham

    As the title says, is it possible? I want to edit the subrecord fields then use getFieldValue to get the new value without having to commit the line first.

    For context, this is with address subrecords on a customer record.
    This is a cached copy. Click here to see the original post.

  • #21446

    pcutler

    This code works fine for me. Am I understanding your question correctly?

    Code:
    function beforeSubmit() {
    var record = nlapiGetNewRecord();

    // select first addressbook line
    record.selectLineItem('addressbook', '1');

    // load the subrecord and set the attention field
    var subrec = record.editCurrentLineItemSubrecord('addressbook', 'addressbookaddress');
    subrec.setFieldValue('attention', 'someone');

    // get the attention value and log it
    nlapiLogExecution('AUDIT', 'Attention', subrec.getFieldValue('attention')); // logs "someone" as expected
    }

  • #21447

    Jordan Manningham

    Precisely. Thanks pcutler! Got it working on my end.

You must be logged in to reply to this topic.