is it my conclusion correct : in beforeSubmit UE, ...
# suitescript
z
is it my conclusion correct : in beforeSubmit UE, not possible to work with sublist (selectNewLine etc) I am trying to fill one custom sublist with external data (https response) inside beforeSubmit UE …
e
Look for dynamic load record, in afterSubmit you need to load the record, in beforeSubmit the record is already loaded, you can work with sublist but using different methods.
z
... but using different methods?
e
Have you checked what I mentioned in suiteanswers? Please take the time to look for dynamic records
Then, you will understand that
z
@eminero are you from official NetSuite support? It seems you are 😢, sorry if i am wrong. I know what is dynamic record (mode) .. I know that.... I dont read SuiteAnswers because it is mostly useless, like your answer. I asked very simple question : is it possible to modify sublist inside the beforeSubmit UE script... You answered "yes you can but using different methods? What methods?
e
https://netsuite.custhelp.com/app/answers/detail/a_id/45396 you need to learn how to use suiteanswer, even how to add details in questions. I am not from NetSuite Support, good luck.
z
Copy code
objRecord.insertLine({
    sublistId: 'attendee',
    line: 2,
   });
objRecord.setCurrentSublistValue({
    sublistId: 'attendee',
    fieldId: 'attendee',
    value: 838
   });
objRecord.commitLine({
    sublistId: 'attendee'
   });
So, answer should be: newrecord and oldrecord in userevent script are always in standard mode. Some of Record.method that manipulate sublist data works only in dynamic mode (like selectNewLine() ) I am going to rewrite beforeSubmit script with insertLine() instead of selectNewLine()…. @eminero thank you for trying to help
e
There you go! If you have clear the foundations, then you will be a better NetSuite Developer
🤢 1
b
you dont actually need to use insertLine unless you are actually inserting a line betwen 2 other lines
you can just use setSublistValue with the line set to whatever number the new line would be on
z
@battk as usually, your answer is short and clear. Thank you.