1

I had an old SuiteScript 1.0 script that added any number of rows to a sublist of an Item Fulfillment when a button was pushed. In that script when i was done I was able to call

nlapiRefreshLineItems('recmachcustrecord_contents_sublist');

What that did was refreshed the subtab contents so it would show the up to date list with the new rows added (or removed).

Anyhow it seems that call does not have a 2.0 equivalent. I noticed I could go and refresh the whole page with the browser RELOAD and it would of course show correctly. Any suggestions on any ways to facilitate that updated sublist via scripting?

jvoigt
  • 400
  • 4
  • 23

1 Answers1

0

via script you have to write a function and trigger it yourself. You can get the field at pageInit using context.currentRecord.getField and then use the same to setSelectOption

  • Thanks for the answer. I didnt notice the reply till now but it's still an issue. I don't follow. I am aware I'd have to put something in a function. What I don't know is what command would have to be called. And when you say getField, do you mean to get the sublist field in question I assume? – jvoigt Apr 22 '21 at 17:47
  • you can add a custom button and add a custom function to it. the definition of the button you can write in client script. There you can add multiple rows to sublist in a loop. Also in 2.0 you need not to refresh the sublist. as loop runs it add and update the UI. – Sumeet kishore Apr 28 '21 at 09:40
  • `for (let counter = 0; counter <5; counter++) {` `curRec.setCurrentSublistText({` `sublistId:'sublist_id,` `fieldId: 'field_id',` `text: 'test,` `ignoreFieldChange: true,` `forceSyncSourcing: true` ` });` `curRec.commitLine({` `sublistId: popupConst.FIELDS.SUBLIST.ID` `});` `}` – Sumeet kishore Apr 28 '21 at 09:43