# NetSuite

To use the **NetSuite Node** in StackAI, use the Custom SuiteQL action. This action allows you to query Netsuite and retrieve any data stored there with a SQL query.

### **Creating a Connection to NetSuite**

StackAI recommends creating connections using a dedicated user account with permissions scoped for the task in question.&#x20;

To create a connection, select **+ NetSuite (OAuth)**. Then, log in with the user account.&#x20;

Here, you will be prompted to enter your Account ID, Client ID, and Client Secret.

#### Permissions

Give your service account user role permissions, and access to the necessary tables that you will be retrieving or writing data to. For access through StackAI, you may need to additionally give the service account permissions for "Analytics and REST" access to the table in question. For access to `Messages` for example, delegate permissions for `Messages` and also for `Messages Analytics and REST`

#### Tips

Always **list the fields explicitly** in your query:

```sql
SELECT id, subject, author, recipient, activitydate
FROM message
WHERE activitydate >= '2025-01-01'
```

You may not be able to use `SELECT *` when querying Netsuite. Your user may not have permissions to all fields, causing an error. NetSuite is also not a traditional relational database; some fields are dynamically defined.
