Is there a way to verify if a sublist field exist ...
# suitescript
l
Is there a way to verify if a sublist field exist from CS? I'm looking to use getCurrentSublistValue on an array of field ids, on multiply transaction forms. some of them don't have all the fields.... for example: "class" field is not existing in the sublist I'm running this function....
Copy code
try{
let check = cRecord.getCurrentSublistValue({
    sublistId: 'item',
    fieldId: 'class',
});
console.log("check: " + check)
}catch (e) {
    log.debug({title:"check field ",details: e})
    
}
e= TypeError: cRecord.getCurrentSublistField is not a function
is it good practice to use a flag fieldExists=true and update it on catch fieldExists = false;?
h
Copy code
const rec = context.currentRecord; 
const field = rec.getSublistField({sublistId:'item', fieldId:'quantity', line:0});
const fieldExist = field ? field.isDisplay : false;