I'm right back at it with 2019.1 upgrade issues. A...
# suitescript
m
I'm right back at it with 2019.1 upgrade issues. Anyone have an issue with specifically setting a value (setValue) on a transaction subrecord? Specifically address subrecord. I removed my workaround code as per https://netsuite.custhelp.com/app/answers/detail/a_id/81500/kw/81500 but now it seems to just be crashing on any non-US salesorder.
b
you probably will have to share code for this one
m
Copy code
setterMethod('shipaddresslist', null);
      var addressrec = rec.getSubrecord('shippingaddress');
      var shipaddress = JSON.parse(shipaddress);

      addressrec.setValue('country', shipaddress['country']);
tried it with and without line 1 (setting shipaddresslist to null)
and i get
Copy code
{
  "type": "error.SuiteScriptError",
  "name": "UNEXPECTED_ERROR",
  "message": null,
  "stack": [
    "anonymous(N/serverRecordService)",
    "shipaddress(/SuiteScripts/restlet_dynamic.js:199)",
    "sharedProperties(/SuiteScripts/restlet_dynamic.js:157)",
    "salesorder(/SuiteScripts/restlet_dynamic.js:133)",
    "mainFunction(/SuiteScripts/restlet_dynamic.js:99)",
    "put(/SuiteScripts/restlet_dynamic.js:57)"
  ],
  "cause": {
    "type": "internal error",
    "code": "UNEXPECTED_ERROR",
    "details": null,
    "userEvent": null,
    "stackTrace": [
      "anonymous(N/serverRecordService)",
      "shipaddress(/SuiteScripts/restlet_dynamic.js:199)",
      "sharedProperties(/SuiteScripts/restlet_dynamic.js:157)",
      "salesorder(/SuiteScripts/restlet_dynamic.js:133)",
      "mainFunction(/SuiteScripts/restlet_dynamic.js:99)",
      "put(/SuiteScripts/restlet_dynamic.js:57)"
    ],
    "notifyOff": false
  },
  "id": "61d1b8d3-7bfe-45f8-859d-880ee332f9bd-2d323031392e30342e3135",
  "notifyOff": false,
  "userFacing": false
}
i think i can get it to work if i explicitly set the address to 'US' before i set it to 'GB' which is insane?
b
and what is shipaddress
m
Copy code
{
  "id": 396262,
  "organization_name": "MedImmune UK Cambridge",
  "site_name": null,
  "attention": null,
  "person_name": ",,",
  "care_of": null,
  "notes": null,
  "total": null,
  "currency": null,
  "address_id": null,
  "latitude": null,
  "longitude": null,
  "street": "Goods Inwards, Aaron Klug Buil",
  "street2": null,
  "city": "Cambridge",
  "state": "GB",
  "zipcode": "CB21 6GH",
  "country": "GB",
  "accuracy": null,
  "bounding_box": {},
  "couch_id": null,
  "origin": null,
  "access": [],
  "created_at": "2019-03-27T09:37:04.706Z",
  "updated_at": null,
  "name": null,
  "site_type": null,
  "text": "Goods Inwards, Buil\nCambridge, GB, CB21 6GH, United Kingdom",
  "addressable_id": 14771,
  "addressable_type": "Pg::PurchaseOrder"
}
json ship address, country is 'GB'
shipaddress['country']
is
'GB'
b
run normally for me
you might want to check that you are passing the correct content type
usually you don't need to parse the json in a restlet
m
well i sent it as a json string
b
usually for restlet i see posting with a content type of application/json. NetSuite automatically parses the post body
m
ah yes, it's sent as part of a larger json data blob that is parsed by the reslet automatically
it's sort of an object within an object, so while the data as a whole is parsed this chunk of it needs to be explicitly parsed later
b
weird
m
but i've confirmed that i'm simply trying to set the country value to a string of 'GB'
b
anyways
debugger
is what i suggest
m
right on thanks