> ## Documentation Index
> Fetch the complete documentation index at: https://docs.refold.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# OAuth Setup

> Access to your users' NetSuite record through OAuth.

To setup your NetSuite app in Refold for OAuth, you will need the following credentials from your NetSuite account:

* Client ID
* Client Secret
* Account ID
* Scopes

### Pre-requisites

1. NetSuite account.
2. OAuth Enabled in Netsuite.

### Required Settings

* **Mandatory Scopes**

1. rest\_webservices
2. suite\_analytics

<Info>If you haven't already created an app in NetSuite, you'd need to create one.</Info>

### Enable OAuth in NetSuite

Before creating an app in NetSuite, you are required to enable OAuth. Follow the steps given below:

1. Navigate to `Setup` > `Company` > `Enable Features` in your Netsuite account.

<img height="200" src="https://mintcdn.com/cobalt-55/wOGvLSncBaYd4o6C/images/Netsuite/netsuite_enable.png?fit=max&auto=format&n=wOGvLSncBaYd4o6C&q=85&s=fd28917dfca2e26725173a366fe9a0ba" alt="Enabling OAuth in Netsuite" data-path="images/Netsuite/netsuite_enable.png" />

2. Select the `SuiteCloud` tab present, scroll down and enable the following in your settings:

* `SOAP Web Services` (under **SuiteTalk (Web Services)**)
* `REST Web Services` (under **SuiteTalk (Web Services)**)
* `SuiteSignon` (under **Manage Authentication**)
* `OAuth 2.0` (under **Manage Authentication**)

### Creating an app in NetSuite

To create a NetSuite app and acquire the above mentioned credentials, please follow the steps mentioned below:

1. Log in to your Netsuite account with Admin permissions.
2. To get your **Account ID**, navigate to `Setup` > `Company` > `Company Information` and copy the `Account ID` present there.

<img height="200" src="https://mintcdn.com/cobalt-55/wOGvLSncBaYd4o6C/images/Netsuite/netsuite_navigation.png?fit=max&auto=format&n=wOGvLSncBaYd4o6C&q=85&s=7f6aee053c8e5c57526888ca783f73a8" alt="Navigating for Account ID" data-path="images/Netsuite/netsuite_navigation.png" />

3. Click on `Setup` > `Integration` > `Manage Integrations` and choose `New`.

<img height="200" src="https://mintcdn.com/cobalt-55/wOGvLSncBaYd4o6C/images/Netsuite/netsuite_create.png?fit=max&auto=format&n=wOGvLSncBaYd4o6C&q=85&s=5435bf1063dd1cd85d5cd8b33d665da1" alt="Navigating for App creation" data-path="images/Netsuite/netsuite_create.png" />

4. Enter the App **Name** and under `Authentication` > `Token-based authentication`, first uncheck the `TBA: Authorization Flow` and then `Token based authentication`.

<Info>
  You are required to first uncheck the TBA: Authorization Flow checkbox as it cannot be disabled if the Token based authentication checkbox is disabled first.
</Info>

5. Go to your [`Apps catalog`](https://app.gocobalt.io/apps) in **Refold** > Search for `Netsuite` > `Settings` > `Use your credentials` > `Callback Url` > Copy it. Paste the Callback Uri under `Redirect URI` field under **OAuth 2.0** in the app.
6. Select the **mandatory scopes** in the **Scope** section under `OAuth 2.0`, as provided in your Refold Netsuite settings page and click on the `Save` button.

<img height="200" src="https://mintcdn.com/cobalt-55/wOGvLSncBaYd4o6C/images/Netsuite/netsuite_config.png?fit=max&auto=format&n=wOGvLSncBaYd4o6C&q=85&s=0aa8374bc2925d51d43954987d50e309" alt="Setting up Developer app" data-path="images/Netsuite/netsuite_config.png" />

8. Scroll down and copy the **Client ID** and **Client Secret** from the `Client Credentials` section.

<img height="200" src="https://mintcdn.com/cobalt-55/wOGvLSncBaYd4o6C/images/Netsuite/netsuite_credentials.png?fit=max&auto=format&n=wOGvLSncBaYd4o6C&q=85&s=fad833b2efa26f6d4577d109f1beecb2" alt="Getting Credentials" data-path="images/Netsuite/netsuite_credentials.png" />

#### Configuring credentials in Refold

App settings page lets you configure the authentication settings for an `OAuth 2.0` based application. For your customers to provide you authorization to access their data,
they would first need to install your application. This page lets you set up your application credentials.

<img height="200" src="https://mintcdn.com/cobalt-55/wOGvLSncBaYd4o6C/images/Netsuite/netsuite_cobalt.png?fit=max&auto=format&n=wOGvLSncBaYd4o6C&q=85&s=40815e9b1f0c8e23431d650ff9f6a5a7" alt="Setting up application client credentials" data-path="images/Netsuite/netsuite_cobalt.png" />

Provide the acquired Client ID and Client Secret under Settings of the app and save it.

#### Configuring Scopes

Refold lets you configure what permissions to ask from your users while they install your application. The scopes can be added or removed from the App settings page, under `Permissions & Scopes`
section.

For some applications Refold sets **mandatory scopes** which cannot be removed. Additional scopes can be selected from the drop down. Refold also has the provision to add any
custom scopes supported by the respective platform.

<img height="200" src="https://mintcdn.com/cobalt-55/wOGvLSncBaYd4o6C/images/Netsuite/netsuite_scopes.png?fit=max&auto=format&n=wOGvLSncBaYd4o6C&q=85&s=4fcf2b49477a15f632a3dab1ecc137b8" alt="OAuth Scopes" data-path="images/Netsuite/netsuite_scopes.png" />

Once the scopes has been added to the application in Refold, go to your Netsuite account and update the scopes as added on Refold.

Select the OAuth App created for Refold > Click on `Edit` > Add the scopes as added in Refold > Click on `Save`.

<Warning>
  If you are facing scopes missing or invalid scope error. Make sure you are not passing any custom scope not supported by the platform. And, the scopes selected here are
  identical to the ones selected in the platform.
</Warning>

#### Actions and triggers

Once the above setup is completed, you can create orchestrations of your use-cases using NetSuite actions and triggers. Following are the set of NetSuite actions and triggers
supported by Refold.

<Tabs>
  <Tab title="Actions">
    <AccordionGroup>
      <Accordion title="Accounts">
        1. **Get Accounts** - Get all accounts in Netsuite.
        2. **Create Account** - Create a new account in Netsuite.
        3. **Update Account** - Update an account in Netsuite.
      </Accordion>

      <Accordion title="Boms">
        4. **Get Boms** - Get all Boms in Netsuite.
        5. **Create Boms** - Create a new Bom in Netsuite.
        6. **Update Boms** - Update an Bom in Netsuite.
        7. **Get Bom by ID** - Get a Bom by ID in Netsuite.
      </Accordion>

      <Accordion title="Campaigns">
        8. **Create Campaign** - Create a campaign in Netsuite.
        9. **Get Campaigns** - Get Campaign list in Netsuite.
        10. **Update Campaign** - Update a campaign in Netsuite.
        11. **Delete Campaign** - Delete a campaign in Netsuite.
      </Accordion>

      <Accordion title="Contacts">
        12. **Create Contact** - Create a contact in Netsuite.
        13. **Get Contact** - Get all contacts in Netsuite.
        14. **Update Contact** - Update a contact in Netsuite.
      </Accordion>

      <Accordion title="Currency">
        15. **Get Currency** - List all currencies in Netsuite.
        16. **Create Currency** - Create a currency in Netsuite.
        17. **Get Currency By Id** - Get a currency by ID in Netsuite.
        18. **Update Currency** - Update a currency in Netsuite.
      </Accordion>

      <Accordion title="Customer">
        19. **Get Customers** - Get all customers in Netsuite.
        20. **Create Customer** - Create a customer in Netsuite.
        21. **Get Customer By Id** - Get a customer by ID in Netsuite.
        22. **Update Customer** - Update a customer in Netsuite.
      </Accordion>

      <Accordion title="Departments">
        23. **Get Departments** - List all departments in Netsuite.
      </Accordion>

      <Accordion title="Employees">
        24. **Get Employees** - Get all employees in Netsuite.
        25. **Create Employee** - Create an employee in Netsuite.
        26. **Update Employee** - Update an employee in Netsuite.
        27. **Delete Employee** - Delete an employee in Netsuite.
      </Accordion>

      <Accordion title="Inventory Items">
        28. **Get Inventory Item** - Get all inventory items in Netsuite.
        29. **Create Inventory Item** - Create an inventory item in Netsuite.
        30. **Update Inventory Item** - Update an inventory item in Netsuite.
      </Accordion>

      <Accordion title="Invoice">
        31. \**Get Invoices* - Get all invoices in Netsuite.
      </Accordion>

      <Accordion title="Opportunities">
        32. **Get Opportunities** - Get all opportunities in Netsuite.
        33. **Create Opportunity** - Create an opportunity in Netsuite.
        34. **Update Opportunity** - Update an opportunity in Netsuite.
        35. **Delete Opportunity** - Delete an opportunity in Netsuite.
      </Accordion>

      <Accordion title="Sales Record">
        36. **Get Sales Record** - Get all sales records in Netsuite.
        37. **Create Create Sales Record** - Create a sales record in Netsuite.
        38. **Get Sales Record By Id** - Get a Sales record by ID in Netsuite.
        39. **Update Sales Record** - Update sales record in Netsuite.
      </Accordion>

      <Accordion title="Subsidiary">
        40. **Get Subsidiary** - Get all subsidiaries in Netsuite.
        41. **Get Subsidiary By Id** - Get a subsidiary by ID in Netsuite.
      </Accordion>

      <Accordion title="Tasks">
        42. **Create Task** - Create a task in Netsuite.
        43. **Get Tasks** - Get all tasks in Netsuite.
        44. **Update Task** - Update task in Netsuite.
        45. **Delete Task** - Delete task in Netsuite.
      </Accordion>

      <Accordion title="Timesheets">
        46. **Get Timesheets** - Get all Timesheets in Netsuite.
      </Accordion>

      <Accordion title="Vendors">
        47. **Create Vendor** - Create a vendor in Netsuite.
        48. **Delete Vendor** - Delete a vendor in Netsuite.
      </Accordion>

      <Accordion title="Others">
        39. **HTTP Request** - Make HTTP API calls to any NetSuite documented REST APIs.
      </Accordion>
    </AccordionGroup>
  </Tab>

  <Tab title="Triggers">
    There are no triggers in this application.
  </Tab>
</Tabs>
