Christiaan
02/01/2019, 3:26 PMvar dateFrom = new Date(Date.UTC(dateToday.getFullYear(),0,1));
var dateTo = new Date(Date.UTC(dateToday.getFullYear(),11,31));
// Find all used codes for the treatment list for this customer and year
var customerID = currRecord.getValue({fieldId: 'custrecord_vq_customer'});
var usedCodes = search.create({
type: 'customrecord_vq_hoevoelvandg_vragenlijst',
filters: [['custrecord_vq_customer', 'is', customerID], 'and', ['custrecordcustrecord_vq_datumvandaag', 'within', [dateFrom,dateTo]], 'and', ['custrecord_vq_minuten_behandeling', 'is', itemId]],
columns: ['internalid', 'custrecord_vq_minuten_behandeling', 'custrecord_vq_apparaatcode']
}).run().each(printCode);