Я начинающий автор сценариев и не могу понять, что я делаю неправильно.Я пытаюсь загрузить очень простой скрипт suitescript 2.0 для вычисления значений в пользовательской таблице.Я могу загрузить файл сценария очень хорошо, но когда я создаю запись сценария, я получаю следующую ошибку: Ошибка оценки сценария: {"type":"error.SuiteScriptModuleLoaderError","name":"UNEXPECTED_ERROR","message":"missing : after property id (SS_SCRIPT_FOR_METADATA#22)","stack":[]}
Вот код
/**
*@NApiVersion 2.x
*@NScriptType ClientScript
*/
define(['N/currentRecord'],
function fieldChanged(context) {
var fieldName=context.currentRecord.fieldID;
//return if not one of these fields
if (fieldName!=='custrecord_am_ehir_emp_prem_percent' &&
fieldName!=='custrecord_am_ehir_dep_prem_percent' &&
fieldName!=='custrecord_am_ehir_total_month_prem')
return false;
else
//get premium and percent values
var totalPremium=currentRecord.getValue(
{fieldID:'custrecord_am_ehir_total_month_prem'
});
var employeeOnlyPremium=currentRecord.getValue(
{fieldID:'custrecord_am_ehir_emp_only_prem'
});
var employeePercent=currentRecord.getValue(
{fieldID:'custrecord_am_ehir_emp_prem_percent'
});
var dependentPercent=currentRecord.getValue(
{fieldID:'custrecord_am_ehir_dep_prem_percent'
});
var employeePremium=totalPremium*employeePercent;
var dependentPremium=(to1talPremium-employeeOnlyPremium)*dependentPercent;
var companyPremium=totalPremium-employeePremium-dependentPremium;
//set field values
currentRecord.setValue(
{fieldID:'custrecord_am_ehir_emp_month_prem',employeePremium
});
currentRecord.setValue(
{fieldID:'custrecord_am_ehir_dep_month_prem',dependentPremium
});
currentRecord.setValue(
{fieldID:'custrecord_am_ehir_co_month_prem',companyPremium
});
return {fieldChanged:fieldChanged};
}
);