This topic contains 7 replies, has 0 voices, and was last updated by starlingMark 7 years, 8 months ago.
-
AuthorPosts
-
September 16, 2016 at 10:23 am #1805
rajohnson2004I cannot figure out how to set the values on a sales order sublist with this dynamic record thing…below is code
Code:
/**
* @NApiVersion 2.0
* @NScriptType UserEventScript
* @NModuleScope SameAccount
*/
define([‘N/record’, ‘N/runtime’, ‘N/error’,’N/xml’, ‘N/file’, ‘N/email’, ‘N/search’, ‘N/format’, ‘N/crypto’, ‘N/https’, ‘N/encode’, ‘N/config’, ‘N/task’],
function(record, runtime, error, xml, file, email, search, format, crypto, https, encode, config, task)
{function beforeSubmit(context) {
var salesOrder = context.newRecord;
var salesOrderId = salesOrder.id;
var numLines = salesOrder.getLineCount({
sublistId: ‘item’
});var anchorNames = new Array();
var anchorQtys = new Array();for (var i = 0; i This is a cached copy. Click here to see the original post.
-
September 16, 2016 at 11:59 am #1806
JacksonPHave you tried insertLine? I vaguely remember having the same issue but I can’t remember from which script. This might help…
Code:
for (var i = 0; i < negativeBin.length; i++) {negativeAdjustment.insertLine({
sublistId: 'inventory',
line: i
});
negativeAdjustment.setSublistValue({
sublistId: 'inventory',
fieldId: 'item',
line: i,
value: itemId
});
negativeAdjustment.setSublistValue({
sublistId: 'inventory',
fieldId: 'binnumbers',
line: i,
value: negativeBin[i]
});
rajohnson2004 replied on 09/16/2016, 01:21 PM: Thanks, Jackson. It definitely got rid of the issue.
-
September 16, 2016 at 1:37 pm #1807
ironsideHmm, setSublistValue() isn’t supported on dynamic records, so I’m at a loss at how that code could get rid of the issue?
-
March 3, 2017 at 7:06 am #1808
starlingMarkI just ran into this same issue. I am on a before submit trigger and trying to retrieve information from a sublist. I have to retrieve several columns from each line, so to try and minimize the lines of code required I wanted to do a selectLine and then getCurrentSublistValue. Then I hit the same error as mentioned by the OP.
chanarbon Can you give us any insight on this? The documentation suggests that this should work just fine.
-
March 3, 2017 at 9:49 am #1809
chanarbonYes. For dynamic, you must use setCurrentSublist() which means that you have to selectLine() . From what we currently have, the best solution is the iteration on the lines. Thanks for the feedback for sublist. Knowing the difficulty in the development with sublists in 2.0 would be a good feedback to our end to improve our end.
-
March 3, 2017 at 10:08 am #1810
starlingMarkThanks for the reply chanarbon. Glad to see that NS has some resources taking this kind of feedback!
-
March 6, 2017 at 4:12 pm #1811
jejacobHi starlingMark,
Am not sure which documentation you are referring to. But this is explicitly stated in Help Guide: https://netsuite.custhelp.com/app/an…etsublistvalue
Method Description
Sets the value of a sublist field. (standard mode only) or Deferred Dynamic modeWhen working in dynamic mode, set a sublist field value using the following methods: Record.selectLine(options)
Record.setCurrentSublistValue(options)
Record.commitLine(options) Method Description
Sets the value of a sublist field. (standard mode only)When working in dynamic mode, set a sublist field value using the following methods:Record.selectLine(options)
Record.setCurrentSublistValue(options)
Record.commitLine(options) -
March 7, 2017 at 4:51 am #1812
starlingMarkjejacob – Right you are! I was confusing a record object with a currentRecord object. Thank you for this.
-
AuthorPosts
You must be logged in to reply to this topic.