🔐 Managing Roles & Permissions for Custom Records and Scripts in NetSuite
Introduction
NetSuite’s flexibility comes with responsibility — controlling who can see, edit, and execute what.
Properly managing roles and permissions ensures your users have the right level of access while protecting sensitive financial data, scripts, and custom records.
In this tutorial, we’ll cover how to:
- Set up and customize roles
- Secure custom records and SuiteScripts
- Manage field-level and workflow access
- Troubleshoot permission errors (like “You do not have permission to access this record”)
💡 Why Role Management Matters
Benefit | Description |
---|---|
Data Security | Prevent unauthorized data access |
Operational Control | Limit who can create or approve transactions |
Compliance | Enforce SOX, GDPR, or internal audit rules |
Script Safety | Control which users can run automation scripts |
Performance | Reduce risk of accidental bulk edits or mass updates |
🧱 Understanding NetSuite Role Structure
Roles determine what records, pages, and actions a user can access.
Each role is made up of:
- Permissions (Record, Transaction, Setup, Lists)
- Access Levels (View, Create, Edit, Full)
- Restrictions (Subsidiary, Department, Class)
- Script and Workflow Executions
Default vs Custom Roles
Type | Description | Use Case |
---|---|---|
Standard Roles | Provided by NetSuite (e.g., Administrator, Accountant) | Quick start |
Customized Standard Role | Copy of a standard role with modifications | Most common |
Fully Custom Role | Built from scratch | Complex security setup |
⚙️ Step-by-Step: Creating a Custom Role
Step 1: Navigate to Role Setup
Go to:
Setup → Users/Roles → Manage Roles → New
Step 2: Define Basic Info
Field | Example |
---|---|
Name | “Custom Record Manager” |
Center Type | Accounting, Sales, or All |
Subsidiary Restriction | “Own + Child” |
Two-Factor Authentication | Optional (Recommended) |
Step 3: Add Permissions
a. Record Permissions
Add:
- Custom Record: Full
- Transactions: View/Edit as needed
- Lists → Employees, Customers, Vendors: View
b. Setup Permissions
Add:
- Script Deployment: View or Edit (for developers)
- Custom Record Types: Edit
- Workflow Management: Full (if creating workflows)
c. Lists Permissions
Include access to lists related to the record (Items, Subsidiaries, Departments).
Step 4: Assign Role to Employee
Go to:
Lists → Employees → Employees → Edit Employee → Access Tab
Add Role → Custom Record Manager
✅ Save.
🧩 Restricting Access to Custom Records
Each Custom Record Type in NetSuite has its own access controls.
Step 1: Edit the Custom Record
Go to:
Customization → Lists, Records, & Fields → Record Types → Edit
Step 2: Set Access Type
Choose between:
- Use Permission List
- Use Role List
- Use Owner Restriction
Step 3: Grant Access
Role | Permission | Level |
---|---|---|
Custom Record Manager | Full | Edit/Delete |
Sales Rep | View Only | Read |
Admin | Full | All access |
Step 4: Enable “Allow UI Access”
If unchecked, records can only be accessed via script — not from the UI.
🧠 Field-Level Permissions
NetSuite does not have built-in field-level security, but you can simulate it using:
- Workflows → Hide/Disable fields based on role or status.
- Client Scripts → Dynamically disable or hide fields on form load.
Example (Client Script):
/**
* @NApiVersion 2.1
* @NScriptType ClientScript
*/
define(['N/runtime'], (runtime) => {
function pageInit() {
const userRole = runtime.getCurrentUser().role;
if (userRole !== 3) { // Role ID 3 = Administrator
document.getElementById('custbody_sensitive_field').disabled = true;
}
}
return { pageInit };
});
✅ This hides or locks fields for non-admin users.
⚡ Securing Script Deployments
Each Script Deployment can be limited to specific roles and audiences.
Steps:
- Go to: Customization → Scripting → Script Deployments → Edit
- Under Audience tab, select:
- Specific Roles (e.g., Accountant, Admin)
- Departments, Subsidiaries, Employees
- Save deployment.
🔐 Tip: Avoid deploying scripts to All Roles unless necessary.
🔄 Workflow Role Permissions
Workflows also respect role-based restrictions:
- In each State Action, you can set “Execute As Role”.
- Only that role will perform the action, regardless of who triggers it.
- Use Custom Fields (Approver Role) to dynamically route records.
🧮 Example: Role-Specific Approval Workflow
Scenario:
Only Managers can approve Purchase Orders.
Setup:
- Create role: Purchase Order Approver
- Workflow condition:
If {currentRole} = Purchase Order Approver → Show Approve Button
- Other users only see Pending state.
🧰 Troubleshooting Permission Errors
Error | Reason | Fix |
---|---|---|
“You do not have permission to access this record.” | Record type not assigned to role | Add record permission (View/Edit) |
“You cannot edit this field.” | Workflow or client script restriction | Check logic or field UI access |
“Script execution failed for user.” | Missing deployment audience | Add user role to deployment |
“Record type undefined.” | Custom Record hidden from UI | Enable “Allow UI Access” |
🧠 Best Practices for Role & Permission Setup
✅ DO:
- Use least privilege principle (only what’s needed).
- Group roles by function, not by person.
- Document all role changes (audit log).
- Test roles in Sandbox before production.
- Use Saved Searches for permission audits.
❌ DON’T:
- Assign Administrator roles broadly.
- Give Full Access unless absolutely necessary.
- Overlap approval and transaction edit permissions in one role.
🧮 Advanced: Script-Based Role Validation
You can restrict script execution with role checks:
define(['N/runtime', 'N/error'], (runtime, error) => {
function execute(context) {
const roleId = runtime.getCurrentUser().role;
if (roleId !== 3) {
throw error.create({
name: 'PERMISSION_DENIED',
message: 'You are not authorized to run this process.'
});
}
}
return { execute };
});
✅ Use this for RESTlets, Suitelets, and Map/Reduce scripts that process sensitive data.
📚 Related Tutorials
- 👉 Advanced Approval Workflows in NetSuite
- 👉 Custom GL Plug-in in NetSuite
- 👉 User Event Scripts for Record Automation
❓ FAQ
Q1. Can I restrict access to specific saved searches?
Yes — under Audience tab on the saved search record.
Q2. Can I prevent users from editing custom records?
Yes — set access level to “View” only in the Custom Record definition.
Q3. Do permissions apply to SuiteScript execution?
Yes — unless scripts use executeAsAdmin
.
Q4. Can I log changes to roles or permissions?
Yes — enable System Notes v2 to track changes made to roles and permissions.
🧭 Summary
Controlling roles and permissions is the foundation of secure NetSuite customization.
By managing access at record, script, and workflow level, you can ensure users interact safely with your system — protecting data, automations, and business logic.
A well-designed role structure keeps your NetSuite environment secure, scalable, and audit-ready.
Leave a Reply