Netsuite SS 2.0 - Populating Sublist data on Suitelet

950 Views Asked by At

I have a Suitelet that returns a form page that a user can specify data on, and when it’s retrieved, the default values are populated based on the data the user entered the previous time.
ie. Data is saved on and sourced from a Custom Record.

I decided to add an Inline Editor Sublist (don't know what I was sniffing).
However I haven’t been able to populate data onto the Sublist when the Suitelet is retrieved.
I am aware it was possible in SS 1.0, but I refuse to use 1.0

Basically the question is: When adding an Inline Editor Sublist to a Suitelet, how can I then populate it with data?

1

There are 1 best solutions below

0
gowtham prakash On

Please create a Client script for your Suitelet and the client script as a reference in your suitelet as given example. In your client Script on pageInit Function run a saved search and populate the Sublist.

Client Script:

var rec = context.currentRecord;

var objSublistSearch = search.load({ id: 'customsearch11208' }); var filter = search.createFilter({ name: 'custrecordzab_s_customer', operator: search.Operator.ANYOF, values: customerid }); objSublistSearch.filters.push(filter); var sublist_count = 0 objSublistSearch.run().each(function(result) { var internalid = result.getValue('internalid'); rec.setCurrentSublistValue({ sublistId: 'custpage_contractsublist', fieldId: 'custpage_internalcontractid', value: internalid, line: sublistCount, ignoreFieldChange: true });
rec.commitLine({ sublistId: 'custpage_contractsublist' }); sublist_count++; }