HI, anybody familiar with this error -> ``` nam...
# general
b
HI, anybody familiar with this error ->
Copy code
name: "FIELD_1_IS_NOT_A_SUBRECORD_FIELD",
   message: "Field inventorydetail is not a subrecord field.",
i was transforming a sales order to an itemfulfillment and setting the inventorydetails.. the items are serial items, and can set the inventorydetails using UI
e
I had the same error earlier today. Using
getSubrecord
for the subsidiary record, and it was a permissions issue. For Admin run OK, for other roles it didn't.
b
thats interesting.. i have this code working for ages then suddenly it can't set up inventorydetails.. btw, my script is on a map/reduce
👀 1
b
are you sure the line has an inventory detail to set
b
@battk, yes. the IF gets created anyway, just the serial. and i can edit the thing and set it inventorydetails manually (using UI).
b
what does the code look like
b
Copy code
var inventoryDetailRecord = ifRec.getCurrentSublistSubrecord({
                sublistId: 'item',
                fieldId: 'inventorydetail'
            });

            var addedSerials = [];

            for (var i = 0; i < validSerialList.length; i++) {
                try {
                    inventoryDetailRecord.selectLine({
                        sublistId: 'inventoryassignment',
                        line: i
                    });

                    if (validSerialList[i] && validSerialList[i] !== 'NA') {
                        inventoryDetailRecord.setCurrentSublistValue({
                            sublistId: 'inventoryassignment',
                            fieldId: 'receiptinventorynumber',
                            value: validSerialList[i]
                        });

                        // inventoryDetailRecord.setCurrentSublistValue({
                        //     sublistId: 'inventoryassignment',
                        //     fieldId: 'issueinventorynumber',
                        //     value: validSerialList[i]
                        // });

                        addedSerials.push(validSerialList[i]);
                    }

                    inventoryDetailRecord.commitLine({
                        sublistId: 'inventoryassignment'
                    });
                } catch (line_error) {
                    log.audit(logTitle, LogPrefix + '## ERROR ## ' + JSON.stringify(line_error));
                }
            }
but im actually catching it on the record.save try..catch
b
which line is the one throwing the error