LMG
09/24/2020, 3:55 PMPabloZ
09/24/2020, 3:57 PMLMG
09/24/2020, 3:58 PMJacob D
09/24/2020, 11:44 PMvar itemParentItem = nRecord.load({
type: nRecord.Type.INVENTORY_ITEM,
id: internalid,
isDynamic: true
});
var invImagesCount = itemParentItem.getLineCount({
sublistId: 'itemimages'
});
try {
if (invImagesCount > 0) {
for (var j = 0; j < invImagesCount; j++) {
var imageName = itemParentItem.getSublistValue({
sublistId: 'itemimages',
fieldId: 'name',
line: j,
}) || '';
var imageAltCaption = itemParentItem.getSublistValue({
sublistId: 'itemimages',
fieldId: 'altTagCaption',
line: j
}) || '';
try {
if (!!!imageAltCaption && imageAltCaption !== ' ') {
//getCaption is just a custom function that I wrote to get data that
//I put into the file name of the image because I find it easier to set
//the alt tags in my filesystem than in NetSuite
imageAltCaption = getCaption(imageName);
itemParentItem.selectLine({
sublistId: 'itemimages',
line: j
});
itemParentItem.setCurrentSublistValue({
sublistId: 'itemimages',
fieldId: 'altTagCaption',
value: imageAltCaption
});
itemParentItem.commitLine({sublistId: 'itemimages'});
}
} catch (e) {
nLog.error({title: 'item caption error', details: JSON.stringify(e)});
nLog.error({title: 'item caption error name', details: imageName});
}
}
}
} catch (e) {
nLog.error({title: 'parent image error', details: JSON.stringify(e)});
}
I’m triggering it in a larger map/reduce script that does a few other item data things, but I imagine you could put it into a user event.PabloZ
09/25/2020, 12:12 PMaltTagCaption
😮 today i learned!LMG
09/25/2020, 2:46 PMandrewm
09/25/2020, 4:22 PMJacob D
09/25/2020, 7:20 PMPabloZ
09/25/2020, 7:21 PMPabloZ
09/25/2020, 7:21 PM