Set Item Options Field via Client Script – SuiteScript 2.0

On a Sales Order in NetSuite I am trying to set the item options for a line item via client script using SuiteScript 2.0.  There item I’m testing with has one item option which is a date field. I have tried setting the option field using the internal ID of the item option field (‘custcol_labor_date’), but this doesn’t work.  I have tried setting the options field.  The records browser shows that the options field is a ‘namevaluelist ‘ field type.  So I tried setting the field like so:


curRec.setCurrentSublistValue({sublistId: 'item',fieldId: 'options', value: {custcol_labor_date: '5/23/2022'}});

This doesn’t work as well.

If I set the option manually through the UI and then get the value of the options field I get something like this.

‘CUSTCOL_LABOR_DATE\x03T\x03Date\x035/20/2022’

If I try to set the options field with the string I got above, it sets the field, but I don’t think that is the proper way to set the field.

If anyone can help it would be greatly appreciated.

Rookie Asked on May 18, 2022 in SuiteScript.
Add Comment
1 Answer(s)

Hi,

Does this work?

curRec.setCurrentSublistValue({sublistId: ‘item’, fieldId: ‘custcol_labor_date’, value: ‘5/23/2022’});

Thanks,

Chris

Intermediate Answered on May 23, 2022.

Chris,

That does not work in 2.0 script. That is how I initially tried to set the value but it wouldn’t set the value.  In 1.0 script you can just do nlapiSetCurrentLineItemValue(‘item’ , ‘custcol_labor_date’ , ‘5/23/2022’).  In 1.0 that works, but when you try the same method but translated into 2.0 script it doesn’t work. I think it might be a bug with the 2.0 script. I have opened up a case with NetSuite and will report back what I they tell me.

on May 23, 2022.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.
  • This site made possible by our sponsors:   Tipalti   Celigo   Limebox   Become a Sponsor   Become a Sponsor