Discussions
Read on for the latest updates including:
• Agenda Builder launch
• SuiteWorld On Air registration
• New NetSuite Prompt Studio Contest
• And more!
Check out this thread to learn more!
Get the lineCount of attachements and notes
Goodafternoon,
is there a way to get the lineCount from attachment (mediaitem) and the notes('note')?
I wanted to create a script, that if there are any attachments and/notes a field get true, so the users can quickly see if there are any attachements and/or notes. before checking communication subtab.
I created below SuiteScript:
const beforeLoad = (context) => {
log.debug('attachment and note script','loaded')
var currentRecord = context.newRecord;
var recType = currentRecord.type.purchaserequisition;
if(context.Type == recType){
let countOfAttachment = currentRecord.getLineCount({
sublistId : 'mediaitem',
});
let countOfNotes = currentRecord.getLineCount({
sublistId : 'note',
});
if(countOfAttachment >= 1) {currentRecord.setValue('custbody_xxw_attachement', true)};
if(countOfNotes >= 1) {currentRecord.setValue('custbody_xxw_icn', true)};