Search code examples
postmansuiteql

Trouble with typed values in SuiteQL Query Response from NetSuite


I am currently working with NetSuite's REST API to retrieve data from a custom record. I am using Postman for testing. When I request the data using the REST endpoint, I receive the expected typed values. Here's an example of the response:

{
    "links": [
        {
            "rel": "self",
            "href": "https://sb1.suitetalk.api.netsuite.com/services/rest/record/v1/CUSTOMRECORD_TEST/1"
        }
    ],
    "created": "2022-09-21T17:21:00Z",
    "custrecord_value": 5000.0,
    "id": "1",
    "isInactive": false //This is correctly represented as a boolean
}

However, when I attempt to retrieve the same data using SuiteQL, all values are parsed as strings in the response, even the boolean values. Here's an example of the SuiteQL request and response:

Request : {"q": "SELECT * FROM CUSTOMRECORD_TEST where id=1"}

Response :

{
    "links": [
        {
            "rel": "self",
            "href": "https://sb1.suitetalk.api.netsuite.com/services/rest/query/v1/suiteql"
        }
    ],
    "count": 1,
    "hasMore": false,
    "items": [
        {
            "links": [],
            "created": "21/09/2022",
            "custrecord_value": "5000",
            "id": "1",
            "isinactive": "F", //The boolean value is represented as a string "F"
        }
    ],
    "offset": 0,
    "totalResults": 1
}

I would like to know if there is a way to receive typed values (especially boolean values) when using SuiteQL queries. Have I missed something in my configuration or query syntax? Any help or guidance would be greatly appreciated.

Thank you!


Solution

  • Answer is : You cannot.

    We had to parse it manually when calling NetSuite with SuiteQL.