I've been trying to replicate some Celigo stuff ar...
# suitescript
r
I've been trying to replicate some Celigo stuff around creating an Item Fulfillment via a custom script off a custom record, but having challenges with the
packagefedex
I see in our Celigo Flow, it has the "Replace All Lines" for all the carrier options we have. And in the record I am working with, I can see it's pre-populated with one package of type
pacakgefedex
that I then remove and attempt to create again with
Copy code
const packageLine = sourceRecord.selectNewLine({
                sublistId: 'packagefedex'
              });

  packageLine.setValue({
                fieldId: packageweightfedex,
                value: 7
              });

       packageLine.setText({
                fieldId: packagetrackingnumberfedex,
                text: 'F1234567890'
              });

    packageLine.commitLine({
                sublistId: packageType.type
              });

     sourceRecord.commitLine({
              sublistId: packageType.type
            });
Will give it one more go using just plain old
weight
for the field name, but upon inspecting a record that's already been filled, I see the fieldId's as in the code above. Also, am I possibly mixing up the commitLine on the packageLine?
b
you are treating the package line as a record/subrecord
its a sublist, its treated as an actual part of the record and you use sublist related apis like Record._*setCurrentSublistValue*_
r
Weird because I was getting values by using the selectLine()
const packageCount = sourceRecord.getLineCount({ sublistId: 'packagefedex' }); And this returns 1 on the transform while the other package types return -1
You're right, got sidetracked wasn't supposed to use the returned record
Running into a separate "Unknown Error" issue now on saving the record.
b
what does the code look like and what is the actual error
r
Since adding the packages, it started throwing it
Copy code
{
  "type": "error.SuiteScriptError",
  "name": "UNEXPECTED_ERROR",
  "message": "Unexpected Error",
  "stack": [
    "UNEXPECTED_ERROR: Unexpected Error",
    " at Object.createError [as nlapiCreateError] (<https://5182243-sb1.app.netsuite.com/javascript/suitescript/2.0/client/N.js?NS_VER=2022.2&minver=17&buildver=31005:828:16>)",
    " at Object.createError [as create] (<https://5182243-sb1.app.netsuite.com/javascript/suitescript/2.0/client/N.js?NS_VER=2022.2&minver=17&buildver=31005:2088:39>)",
    " at myCallback (<https://5182243-sb1.app.netsuite.com/javascript/suitescript/2.0/client/N.js?NS_VER=2022.2&minver=17&buildver=31005:2309:49>)",
    " at p.onload (<https://5182243-sb1.app.netsuite.com/assets/suitescript_bootstrap/1101104453.js?NS_VER=2022.2&minver=17:14:423>)"
  ],
  "cause": {
    "stack": "UNEXPECTED_ERROR: Unexpected Error\n at c (<https://5182243-sb1.app.netsuite.com/assets/suitescript_bootstrap/1101104453.js?NS_VER=2022.2&minver=17:12:425>)\n at p.onload (<https://5182243-sb1.app.netsuite.com/assets/suitescript_bootstrap/1101104453.js?NS_VER=2022.2&minver=17:14:377>)",
    "message": "Unexpected Error",
    "name": "UNEXPECTED_ERROR",
    "userFacing": true
  },
  "notifyOff": false,
  "userFacing": true
}
I'll loop through to see if the package list is updated. I'm not getting the
weight
error anymore.
Same result in client script and in scheduled script
b
no code means you try and get netsuite support to find the actual error for you
r
Thanks, I'll go back to the run-around-factory there. I might be able to figure it out doing a compare of my "transform" record and an actual fulfillment....Then again, there's hope they can see the back-end and say "oh it's this"
m
You can debug the connection in Celigo to see the SuiteScript it generates
r
Support identified part of the issue is not having the FedEx integration enabled in our sandbox...I'm trying to bypass this, and used a "other" ship method but get the dialog preventing it from being used...unless I just try it again after changing the ship method thrown error.
The dialog I'm trying to bypass within NetSuite if I use a different shipmethod:
Copy code
Switching the shipping method to another carrier is an unsupported operation, because it requires reloading the item fulfillment form for that carrier.
b
change the shipping method on the item fulfillment in the ui
and pay attention to the url's query parameters, you will need to set the same parameters in the defaultValues
r
In this case, I'm not using the UI.
b
learn
🙌 1
r
ok, I'll change and review the URL
nsi=13
that's the difference, setting the defaultValue "nsi=13" got around it.