Daniel Patton
06/18/2026, 1:33 PMCeligo AI
06/18/2026, 1:33 PMAI generated answer (using internal Slack threads):To get the current role of a user in a NetSuite Restlet, you can use the
runtime module's getCurrentUser() function, which returns a User object. The role property of this object will give you the internal ID of the current user's role. Here is a sample code snippet:
javascript
var runtime = require('N/runtime');
var role = runtime.getCurrentUser().role;
However, if you want to get the name of the role, you will need to use the search or query module to look up the role name using the role ID. Here is a sample code snippet:
javascript
var search = require('N/search');
var roleName = search.lookupFields({ type: 'role', id: role, columns: ['name']}).name;
Please note that the Restlet will run with the permissions of the role of the current user. If the current user's role does not have permission to access the role record, you will not be able to get the role name using this method. In such cases, you might need to use a Suitelet that runs as an Administrator and is available without login, which takes a role ID and returns the name.
******
Disclaimer:
This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes.
******Celigo AI
06/18/2026, 1:33 PMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.825134397
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.822265744
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.813903928
Celigo AI
06/18/2026, 1:33 PM