The validation can be done using the validateLine entry point of client script without the help of any additional custom fields but using the “line” field.
The sample script is given below,
function validateLine(context) {
try {
if (context.sublistId == 'item') {
var lineId = context.currentRecord.getCurrentSublistValue({ sublistId: 'item', fieldId: 'line' });
if (!lineId) {
context.currentRecord.setCurrentSublistValue({ sublistId: 'item', fieldId: 'custcol_jj_total_fp_qty_cdus_3346', value: null, ignoreFieldChange: false });
context.currentRecord.setCurrentSublistValue({ sublistId: 'item', fieldId: 'custcol_jj_recent_pf_qty_cdus_3346', value: null, ignoreFieldChange: false });
context.currentRecord.setCurrentSublistValue({ sublistId: 'item', fieldId: 'custcol_jj_sent_to_fp_cdus_3346', value: false, ignoreFieldChange: false });
context.currentRecord.setCurrentSublistValue({ sublistId: 'item', fieldId: 'custcol_lookupcode_cdus_3346', value: null, ignoreFieldChange: false });
}
}
return true;
} catch (e) {
console.log("error@validateLine", e)
}
}