Boris Yasen
07/10/2023, 6:26 PMfunction validateLine(context){
if(context.sublistId == "custpage_fee_lines"){
let form = context.currentRecord;
let Price = form.getValue('custpage_price');
let Amount = form.getValue('custpage_amount');
if(!isNull(Amount) && !isNull(Price)){
let cnt = form.getLineCount('custpage_fee_lines');
let total = 0;
let rate = form.getCurrentSublistValue({
sublistId: 'custpage_fee_lines',
fieldId: 'custcol_fee_rate',
})
console.log(Amount, Price, rate);
form.setCurrentSublistValue({
sublistId: 'custpage_fee_lines',
fieldId: 'custpage_fee_calced',
value: rate * Amount * Price,
ignoreFieldChange: true
});
for(let i=0;i<cnt;i++){
form.selectLine({
sublistId: 'custpage_fee_lines',
line: i
});
total += form.getCurrentSublistValue({
sublistId: 'custpage_fee_lines',
fieldId: 'custpage_fee_calced',
})
}
}
}
return true;
}
validateLine herereptar
07/10/2023, 7:49 PM