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

  • Author
    Posts
  • #1507

    pcutler

    Here’s my scenario:

    I have a custom record type that’s a child of transaction records, meaning I have a List/Record field that references a transaction and I checked RECORD IS PARENT. I also made this field mandatory. Let’s say the field ID of this field is custrecord_transaction. Let’s also say we have a free-form text field with the ID custrecord_text. On the transaction type, I enabled child record editing.

    I have a SS 1.0 user event script that creates a child record before submit. The script looks like this:

    Code:
    function beforeSubmit()
    {
    var salesorder = nlapiGetNewRecord();
    salesorder.selectNewLineItem(‘recmachcustrecord_transaction’);
    salesorder.setCurrentLineItemValue(‘recmachcustrecord_transaction’, ‘custrecord_text’, ‘1’);
    salesorder.commitLineItem(‘recmachcustrecord_transaction’);
    }
    I have a SS 1.0 script that creates transactions. This works fine:

    Code:
    var salesorder = nlapiCreateRecord(‘salesorder’, {recordmode: ‘dynamic’, ‘entity’: 115});
    salesorder.selectNewLineItem(‘item’);
    salesorder.setCurrentLineItemValue(‘item’, ‘item’, ‘5’);
    salesorder.commitLineItem(‘item’);
    nlapiSubmitRecord(salesorder);
    I re-wrote the same script in SS 2.0:

    Code:
    var salesorder = record.create({ type: record.Type.SALES_ORDER, isDynamic: true, defaultValues: {entity: 115 }});
    salesorder.selectNewLine({sublistId: ‘item’});
    salesorder.setCurrentSublistValue({fieldId: ‘item’, sublistId: ‘item’, value: ‘5’})
    salesorder.commitLine({sublistId: ‘item’});
    salesorder.save();
    This script throws the following error:

    MISSING_REQD_FLD Missing required value for mandatory field: custrecord_transaction

    Has anyone run into this before?
    This is a cached copy. Click here to see the original post.

You must be logged in to reply to this topic.