missing : after property id (adhoc$-1$debugger.use...
# suitescript
s
missing : after property id (adhoc$-1$debugger.user#38) I didn't understand the reason for this error. Can someone help me? I'm trying to fetch field data and do a manipulation on it
Copy code
function beforeSubmit(context) {
      try{
        var newRecord = context.currentRecord;

        var faturamento = [];
      
        if(newRecord.id){ 
          //carrega um registro do tipo Fatura
          var invoiceRecord = record.load({
            type: newRecord.type,
            id: newRecord.id
          });
  
          var termsRecord = record.load({
            type: newRecord.type.TERM,
            id: 193
          });
  
          var terms = termsRecord.getField({
            fieldId: "duenextmonthifwithindays"
  
          });
  
          var invoiceLines = invoiceRecord.getLineCount({
            sublistId: "installment"
          });
  
          for(var i=0; i<invoiceLines ; i++){
          //busca o valor de sublista 
            var duedateLine = invoiceRecord.getSublisValue({
              sublistId: "installment",
              fieldId: "duedate",
              line: i
            });
  
            //envia duedateLine para o objeto faturamento
            faturamento.push({
              duedateLine
            });
          }
          log.debug("invoice", invoice);
    
          if (context.type === context.UserEventType.edit) {

            var novaData = new Date(terms);
  
            invoiceRecordRecord.setValue({
              fieldId: "duedate",
              value: novaData
            });
          }
    
          invoiceRecord.save();
        }
       
      } catch(e){
          log.error(e)
        }
  }
c
Copy code
faturamento.push({
              duedateLine
            });
specify an object property or just push the duedateline with no object.
😄 1
s
Sorry @creece, how do I do this?
b
you cant use any of the ECMAScript 2015 shorthand in suitescript 2.0
😄 1
s
thanks, @battk 😄