Rick Goodrow
01/22/2025, 7:51 PMLIST
that is being created via code (adding sublist, columns, and data in a beforeLoad
function. Within beforeLoad()
, I can populate the sublist by using .setSublistValue()
How can I manually rebuild the data from a Client Script? tried both N/currentRecord.selectLine()
& .setSublistValue()
& getting an SSS_INVALID_SUBLIST_OPERATION CurrentRecord.selectLine
.erictgrubaugh
01/22/2025, 7:53 PMLIST
Rick Goodrow
01/22/2025, 7:58 PMEDITOR
, but that introduces a different issue since people shouldn't be able to edit the list directly.Rick Goodrow
01/22/2025, 7:59 PMbattk
01/23/2025, 12:26 AMRick Goodrow
01/23/2025, 3:46 AMbattk
01/23/2025, 3:58 AMbattk
01/23/2025, 3:59 AMbattk
01/23/2025, 3:59 AMbattk
01/23/2025, 4:00 AMbattk
01/23/2025, 4:11 AMRick Goodrow
01/23/2025, 4:17 AMCREATE
vs EDIT
). I thought maybe I could customize the function that the refresh button does, but didn't see any way to do that either.battk
01/23/2025, 4:17 AMbattk
01/23/2025, 4:17 AMRick Goodrow
01/23/2025, 4:18 AMbattk
01/23/2025, 4:19 AMbattk
01/23/2025, 4:20 AMRick Goodrow
01/23/2025, 4:20 AMRick Goodrow
01/23/2025, 4:21 AMRick Goodrow
01/23/2025, 4:24 AM.addRefreshButtion()
. Hitting it triggers an XHR request to https://<tenant>.<http://app.netsuite.com/app/accounting/transactions/salesord.nl?nexus=1&warnne[…]custpage_uv_fq_sublist_freight_quotes&ts=1737606094626|app.netsuite.com/app/accounting/transactions/salesord.nl?nexus=1&warnne[…]custpage_uv_fq_sublist_freight_quotes&ts=1737606094626>
. so.. looks like it would be the same user event attached to the transaction? And response looks like an HTML that is the form with a bunch of additional javascript scripts attached in htmlRick Goodrow
01/23/2025, 4:26 AMbeforeLoad
of it. But I'm lost as to how to divert requests on a sublist refresh away from the normal transaction beforeLoad
that would trigger when just opening the record normallyRick Goodrow
01/23/2025, 4:26 AMbattk
01/23/2025, 4:27 AMbattk
01/23/2025, 4:27 AMbattk
01/23/2025, 4:28 AMscriptContext.request
Rick Goodrow
01/23/2025, 4:34 AM<tenant>.<http://app.netsuite.com/app/accounting/transactions/salesord.nl?id=267972&whence=&e=T|app.netsuite.com/app/accounting/transactions/salesord.nl?id=267972&whence=&e=T>
.
and it returns the complete html of the entire transaction. When hitting the refresh button, the url is
• <tenant>.<http://app.netsuite.com/app/accounting/transactions/salesord.nl?nexus=1&warnnexuschange=F&at=T&cf=174&includecsc=T&id=267972&r=T&e=T&id=267972&machine=custpage_uv_fq_sublist_freight_quotes&ts=1737606094626|app.netsuite.com/app/accounting/transactions/salesord.nl?nexus=1&warnnexuschange=F&at=T&cf=174&includecsc=T&id=267972&r=T&e=T&id=267972&machine=custpage_uv_fq_sublist_freight_quotes&ts=1737606094626>
which returns only the html of the sublist. So, what I'm trying and failing at asking is, if both requests are hitting the same beforeLoad()
, within the transactions attached User Event, do you know what check I can make within there to only run the code would return the sublist with updated data. None of the context.UserEventTypes
seem to match against a sublist refreshbattk
01/23/2025, 4:35 AMbattk
01/23/2025, 4:36 AMRick Goodrow
01/23/2025, 4:36 AMmachine
at least does have the id I specified as the sublist ID, so that would be a good start. Thank you.Rick Goodrow
01/23/2025, 4:37 AMRick Goodrow
01/23/2025, 5:54 PMbeforeLoad
of the transaction
if (scriptContext.request.parameters.hasOwnProperty('machine')) {
let sublistRefreshID = scriptContext.request.parameters['machine'];
let freightQuoteSublist = scriptContext.form.getSublist({
id: uvFQLibID.sublist.FREIGHT_QUOTES.id,
});
freightQuoteSublist.setSublistValue({
id: uvFQLibID.sublist.FREIGHT_QUOTES.field.ID,
line: 0,
value: Math.random() + 'manual',
});
}
uvFQLib.generateFreightQuoteSublist(scriptContext);
then I get an error that freightQuoteSublist
is undefined, which means the sublist doesn't exist yet (the uvFQLib.generateFreightQuoteSublist()
is what has the .addSublist()
function in it.
Only thing I can think of is that when the refresh button is it, the request to the server is basically an entire record load, complete with all events & triggers, on NetSuite's end, then NetSuite intercepts the response as a final hop, and strips out all the HTML except for the sublist, and then only returns that. This runs completely opposite to how I normally handle XHR requests, which is to only do/process what the XHR request is for and provide just that, not do the entire work again, and then remove what you don't need. I guess I'll have to chalk this up to another NetSuite quirk.battk
01/23/2025, 11:48 PMbattk
01/23/2025, 11:48 PMRick Goodrow
01/23/2025, 11:56 PM