I'm trying to retrieve available options for shipping method for sales order form but I encountered an unexpected error in using getSelectOptions.
function get_select_options(datain)
{
var rec = nlapiCreateRecord(datain.recordType);
var field = rec.getField(datain.field);
var options = field.getSelectOptions();
return options;
}
And here's my code for calling the script.
$url = "https://rest.sandbox.netsuite.com/app/site/hosting/restlet.nl";
$client = new Client();
$authorization = [
'NLAuth nlauth_account='.getenv('NETSUITE_ACCOUNT'),
'nlauth_email='.getenv('NETSUITE_EMAIL'),
'nlauth_signature='.getenv('NETSUITE_PASSWORD'),
'nlauth_role='.getenv('NETSUITE_ROLE')
];
$response = $client->request('GET', $url,
'headers' => [
'Authorization' => implode(',', $authorization),
'Content-Type' => 'application/json'
],
'query' => [
'script' => '343',
'deploy' => '1',
'recordType' => 'salesorder',
'field' => 'shipmethod'
]
]);
return json_decode($response->getBody());
My record type and field seems to be correct as what I have read in the docs. I also followed some of the example codes that uses getSelectOptions, but I can't move on because of some unexpected/unknown error. I also tried to return only the record (rec) just to make sure that my PHP code is working.
GuzzleHttp\Exception\ServerException with message
'Server error: `GET https://rest.sandbox.netsuite.com/app/site/hosting/restlet.nl?script=343&deploy=1&recordType=salesorder&field=shipmethod`
resulted in a `500 Internal Server Error` response:
{"error" : {"code" : "UNEXPECTED_ERROR", "message" : "An unexpected error has occurred. Error ID: irc3j6d915k2asvrqbfhb" (truncated...) '