I'm not aware of hidden fields not being accessibl...
# suitescript
e
I'm not aware of hidden fields not being accessible to Client Scripts. I use them all the time to pass values e.g. internal IDs
🙄 2
r
Hi @erictgrubaughon a Suitlet Line if I don;t make field an
ENTRY
field It does not allow me to write to it after the page is loaded
Copy code
I used nlapiSetLineItemValue
b
try using nlapiSetCurrentLineItemValue instead
or perhaps nlapiRefreshLineItems after you use nlapiSetLineItemValue
r
ok will try that now. @battk and set the field as Hidden instead of entry
@battk if the element is NOT entry I get a error
Copy code
NLAPI.jsp?NS_VER=2019.2.0&minver=132&JSP_VER=1&locale=en_AU:4490 Uncaught TypeError: Cannot read property 'checkvalid' of undefined
    at nsapiFireOnChange (NLAPI.jsp?NS_VER=2019.2.0&minver=132&JSP_VER=1&locale=en_AU:4490)
    at coreSetCurrentLineItemValue (NLAPI.jsp?NS_VER=2019.2.0&minver=132&JSP_VER=1&locale=en_AU:1192)
    at nlapiSetCurrentLineItemValue (NLAPI.jsp?NS_VER=2019.2.0&minver=132&JSP_VER=1&locale=en_AU:1240)
    at <anonymous>:23:1
b
what type of page object is this?
r
Suitlet List Field
Copy code
var breakdownJSON = list.addField(FORM.LIST.FIELD.VENDOR_PRICING_BREAKDOWN, NETSUITE.FIELD_TYPE.TEXTAREA, 'Pricing Breakdown JSON');
  breakdownJSON.setDisplayType('entry')
@battk have you ever written a value to a hidden field(non entry field) on a suitelet via a client script?
b
on normal forms sure
Lists I rarely use
that said, are you sure this is a List
keep in mind that for ui stuff, there is a difference between a List and a Sublist
r
Sorry its a sublist
Copy code
form.addSubList
b
what type of sublist
r
nlobjSubList of type List
b
works normally to me
share the code you used to create your form and set your fields in clientscript
r
But what type is your line field
b
Copy code
/**
 *@NApiVersion 2.0
 *@NScriptType Suitelet
 */
define(["N/ui/serverWidget"], function(serverWidget) {
  return {
    onRequest: function(context) {
      log.debug("parameters", context.request.parameters);

      var form = serverWidget.createForm({
        title: "Simple Form"
      });
      var sublist = form.addSublist({
        id: "custpage_sublist",
        type: serverWidget.SublistType.LIST,
        label: "List Sublist"
      });
      sublist
        .addField({
          id: "custpage_entry",
          type: serverWidget.FieldType.TEXT,
          label: "ENTRY"
        })
        .updateDisplayType({
          displayType: serverWidget.FieldDisplayType.ENTRY
        });
      sublist
        .addField({
          id: "custpage_hidden",
          type: serverWidget.FieldType.TEXT,
          label: "HIDDEN"
        })
        .updateDisplayType({
          displayType: serverWidget.FieldDisplayType.HIDDEN
        });
      sublist.setSublistValue({
        id: "custpage_entry",
        line: 0,
        value: "entry"
      });
      form.addSubmitButton({
        label: "Submit Button"
      });

      context.response.writePage({ pageObject: form });
    }
  };
});
code for setting the field in client script was:
Copy code
nlapiSetLineItemValue('custpage_sublist', 'custpage_hidden', 1, "hiddenvalue")
clicking submit, and then looking at the log
r
Can you go to the console and set value
b
yes
literally what i pasted for the client script
i didnt actually do a client script as you can see from my example code
r
Let me try again
Damm it worked thank you. When I frist built it year ago when I did give a error when i changed it to hidden.. But now it works
🙄 1
Bloddy hell
Thank you @battk 🙏