hi everyone, anyway in SuiteScript to tell if the ...
# suitescript
w
hi everyone, anyway in SuiteScript to tell if the item on transaction record is a serialized item? Thanks in advance. I am with no luck to get there using below:
var is_SNitem = CurrentRec.getCurrentSublistValue({
sublistId: 'item',
fieldId: 'item'
});
var FieldLookup = search.lookupFields({
type: search.Type.ITEM,//
id: is_SNitem, //
columns: ['isserialitem'] //
});
a
if you log
is_SNitem
are you getting the item id value?
what context are you doing this in?
what type of script is this?
w
@Anthony OConnor it is client type, what I get in log is_SNitem = undefined
saveRecord(scriptContext)
a
are you looping through the lines?
you fieldlookup code looks fine, you're just not getting the item internal id from that first piece of code
are you selecting a line?
also just fyi, and I know its not what you're asking , but its pretty common to just source item data onto custcol fields for transactions lines that's more efficient that doing lookups to the item table for every single item/line
there are two similar and but distinct sets of sublist methods in the record module. One uses "current" and you need to select your lines for those the other you have to pass the linenumber in as another key value pair
w
yes, line is selected. i will give it a go to source it from custcol
👍 1
thanks for the best practice, appreciate it @Anthony OConnor