The below sample script can be used to disable the item sublist fields in transaction records in Workflow action script
const onAction = (scriptContext) => {
try{
if (scriptContext.type == 'edit')
{
let record = scriptContext.newRecord;
// Add the line fields that need to be disabled to an array
let itemFieldIds = ["quantity", "amount", "rate", "price"];
let form = scriptContext.form;
// Disable fields
for (let i = 0; i < itemFieldIds.length; i++)
{
form.getSublist({
id: 'item'
}).getField({
id: itemFieldIds[i]
}).updateDisplayType({
displayType: serverWidget.FieldDisplayType.DISABLED
});
}
}
} catch (e) {
log.error("error @ beforeLoad", e);
}
}
return {onAction};
});