title: How to create invoice using suitescript 2.0?
body: <p>I have tried to create invoice in the client script event. </p>
  
  <pre class="lang-js prettyprint-override"><code>var objRecord = record.create({
      type: 'invoice',
      isDynamic: false
  });
  
  objRecord.setValue({
      fieldId: 'customform',
      value: '296',
      ignoreFieldChange: true
  });
  objRecord.setValue({
      fieldId: 'account',
      value: '215',
      ignoreFieldChange: true
  });
  objRecord.setValue({
      fieldId: 'entity',
      value: '13276',
      ignoreFieldChange: true
  });
  objRecord.setValue({
      fieldId: 'currency',
      value: '1',
      ignoreFieldChange: true
  });
  objRecord.setValue({
      fieldId: 'postingperiod',
      value: '294',
      ignoreFieldChange: true
  });
  objRecord.setValue({
      fieldId: 'exchangerate',
      value: '1.0',
      ignoreFieldChange: true
  });
  objRecord.setValue({
      fieldId: 'custbody_amortization_partner_currency',
      value: '6',
      ignoreFieldChange: true
  });
  objRecord.setValue({
      fieldId: 'memo',
      value: v_adv_memo,
      ignoreFieldChange: true
  });
  objRecord.setValue({
      fieldId: 'custbody_amortization_advance_id',
      value: v_advanceID,
      ignoreFieldChange: true
  });
  objRecord.setValue({
      fieldId: 'trandate',
      value: parsedDateStringAsRawDateObjectdtl,
      ignoreFieldChange: true
  });
  objRecord.setValue({
      fieldId: 'duedate',
      value: v_adv_pymt_pymt_date,
      ignoreFieldChange: true
  });
  objRecord.selectNewLine({
      sublistId: 'item'
  });
  objRecord.setCurrentSublistValue({
      sublistId: 'item',
      fieldId: 'item',
      value: '5825',
      ignoreFieldChange: true
  });
  objRecord.setCurrentSublistValue({
      sublistId: 'item',
      fieldId: 'quantity',
      value: '1',
      ignoreFieldChange: true
  });
  objRecord.setCurrentSublistValue({
      sublistId: 'item',
      fieldId: 'amount',
      value: '100',
      ignoreFieldChange: true
  });
  objRecord.commitLine({
      sublistId: 'item'
  });
  
  var recId = objRecord.save({
      enableSourcing: true,
      ignoreMandatoryFields: true
  });
  
  alert(recId);   
  </code></pre>
  
  <p>I am not sure where the error occurs. Can anyone help me on this topic ?      </p>