Сценарий развертывания SuiteScript Не удалось оценить сценарий - PullRequest
0 голосов
/ 17 января 2019

Я делаю usereventcript, который рассчитывает для ставки с использованием подполей из списка позиций заказа на продажу. при попытке сохранить и развернуть скрипт запускает ошибку. Не удалось оценить скрипт: {"type": "error.SuiteScriptModuleLoaderError", "name": "UNEXPECTED_ERROR", "message": "отсутствует} после списка свойств (SS_SCRIPT_FOR_METADATA # 32)" , "стек": []}

enter image description here

/**
*@NApiVersion 2.x
*@NScriptType UserEventScript
*/
define(
[
    'N/record'
],
function (record) {

    /**
    * @param {UserEventContext.beforeSubmit} context
    */
     function beforeSubmit(context) {
        //get taxcode
        var taxcode = context.newRecord.getValue({
            fieldId: 'taxcode'
          });
        if(taxcode !== 0 || taxcode !== 4){
            // Gets the Total Amount
            var amount = context.getValue.getValue({
              fieldId: "amount"
            });

        // Gets the quantity of an item selected
        var quantity = context.newRecord.getValue({
        fieldId: 'quantity'
        });            
        var rate_ = amount/quantity;
        var newRate = context.newRecord.setValue({
            fieldId : 'rate'
            value : ('rate',rate_)
            });
        }
    }


    return {

        // beforeSubmit: beforeSubmit,

    };
});

1 Ответ

0 голосов
/ 17 января 2019

Ваш код не является синтаксически действительным. Пожалуйста, замените ниже код

var newRate = context.newRecord.setValue({
  fieldId: 'rate'
  value: ('rate', rate_)
});

с

var newRate = context.newRecord.setValue({
  fieldId: 'rate',
  value: ('rate', rate_)
});

Вы можете попробовать проверить код с помощью средства проверки синтаксиса JS esprima . Хотя многие IDE теперь поддерживают валидацию.

...