Trying to create a invoice and getting the followi...
# suitescript
n
Trying to create a invoice and getting the following error. Anyone seen this and can help narrow my search for the issue?
Copy code
Invalid country reference key undefined.
m
Is your Country Code you are setting two-letters?
n
Im not setting country code at all. I am setting address list fields with address ids so that is why i am confused.
m
NS requires a country to be selected when messing with an address in the UI. I would duplicate what you are attempting to accomplish with SS, in the UI.
n
There is another invoice with the same values and no issues so its weird
So this is odd. I am getting this error in a try catch when creating the invoice. However, i am realizing the invoice is still being created. So weird
Copy code
{
  "type": "error.SuiteScriptError",
  "name": "INVALID_KEY_OR_REF",
  "message": "Invalid country reference key undefined.",
  "stack": [
    "Error\n at RecordInvoker.save (suitescript/resources/javascript/record/serverRecordService.js:371:13)\n at NetSuiteObject.thenableFunction() (suitescript/resources/javascript/record/proxy.js:115:24)\n at Object.invoice (/SuiteBundles/Bundle 390672/DC - PL - Work Order Invoicing.js:1149:48)\n at Object.map (/SuiteBundles/Bundle 390672/DC - MR - WO - Invoicing.js:52:29)"
  ],
  "cause": {
    "type": "internal error",
    "code": "INVALID_KEY_OR_REF",
    "details": "Invalid country reference key undefined.",
    "userEvent": null,
    "stackTrace": [
      "Error\n at RecordInvoker.save (suitescript/resources/javascript/record/serverRecordService.js:371:13)\n at NetSuiteObject.thenableFunction() (suitescript/resources/javascript/record/proxy.js:115:24)\n at Object.invoice (/SuiteBundles/Bundle 390672/DC - PL - Work Order Invoicing.js:1149:48)\n at Object.map (/SuiteBundles/Bundle 390672/DC - MR - WO - Invoicing.js:52:29)"
    ],
    "notifyOff": false
  },
  "id": "",
  "notifyOff": false,
  "userFacing": true
}
e
The error is probably coming from an
afterSubmit
User Event in whatever Bundle has ID
390672
. A failure in
afterSubmit
occurs after the record has been created
n
@erictgrubaugh Hmm i looked through script execution logs but don't see the error any where else in other scripts
If it happened in a 1.0 UE library script, would that error show up?
@erictgrubaugh thanks for the help, i found the issue in a library script on a ue
1