I am trying to learn about Suitelets and have been...
# suitescript
c
I am trying to learn about Suitelets and have been trying to figure out how can I update a field on the record from the sublist. I have a simple SL script that just displays an order number and PO field (otherrefnum) and I have attached a client script. Once I make an edit to the field I keep getting an error saying the record does not exist.
Copy code
function fieldChanged(scriptContext) {
    if (scriptContext.fieldId == "cuspage_po_number") {
      var suiteletRecord = currentRecord.get();
      console.log("suiteletRecord", suiteletRecord);
a
... what you've described doesn't really make sense if the suitelet is a suitelet form, then its technically not a record, even though it might look like one, which I think might the source of your problem, or my misunderstanding at least. while this is a common use case for suitelets there are others so its important to be more specific about what your suitlelet code does. just looking at the code you shared the fieldId looks like it has a typo, it says
cuspage_xxx
that should be
custpage_xxx
c
I figured out what was going on. I was using another script as reference and it didn't make sense to me how they were passing the information. They have hidden fields on the sublist and another function being called to pass that information. This is how they are able to pull the current record when making an inline update.
👍 1
They were using hidden select boxes that get marked when you click on the entry fields and when you move away they get submitted via a function that is called. Should have taken more time to read what was already built instead of trying to do it step by step.