I’m trying to search a custom record in netsuite. ...
# suitescript
s
I’m trying to search a custom record in netsuite. I can view them by going
Customization
->
Lists, Records & Fields
->
Record Types
. From here I can see the ns internal id of the table and the name of the record type, lets say the internal id is
customrecord_pricetable
and its named
Price Table
. I can also click list and view the records in the custom record type. When I visit
Setup
->
Users/Roles
->
Manage Roles
, Click on the
Token-Based Authentication Role
I setup for my API integrations. And then look at the
Permissions
tab and then at the
Custom Record
tab, It shows that I have given this role full access to the
Price Table
Custom Record. I then try to run this search command:
Copy code
function processResult(result){
          var nsInternalId = result.getValue("internalid");
          myLog.debug({
            title: "result",
            details: result.getValue("custrecord_subsidiary")
          });
          return true;
        }
        var objSearch = search.create({
          type: "customrecord_pricetable",
          columns:[
            {
              name: "internalid"
            },
            {
              name: "custrecord_subsidiary"
            }
         ]
        }).run().each(processResult);
but it gives me this error message:
Copy code
{
  "error": {
    "code": "JS_EXCEPTION",
    "message": "{\"type\":\"error.SuiteScriptError\",\"name\":\"INSUFFICIENT_PERMISSION\",\"message\":\"Permission Violation: You need a higher permission for custom record type Affiliator Price Table to access this page. Please contact your account administrator.\",\"stack\":[\"createError(N/error)\",\"get(/SuiteScripts/helloKumar2.js:20)\"],\"cause\":{\"type\":\"internal error\",\"code\":\"INSUFFICIENT_PERMISSION\",\"details\":\"Permission Violation: You need a higher permission for custom record type Affiliator Price Table to access this page. Please contact your account administrator.\",\"userEvent\":null,\"stackTrace\":[\"createError(N/error)\",\"get(/SuiteScripts/helloKumar2.js:20)\"],\"notifyOff\":false},\"id\":\"\",\"notifyOff\":false}"
  }
}
When I update the restlet to return a simple string like “Hello World” that returns just fine and I do not get any permissions error.