2

Is there a way to get the list of roles that are available in an Netsuite account? I am working on a provisioning solution with Netsuite and I am very new to netsuite. if anyone can point to APIs where I can get list of roles (employee roles?), it would be helpful

user2739843
  • 67
  • 1
  • 2
  • 6

4 Answers4

4

To view Roles list:

Go to Setup > Users/Roles > Manage Roles

There is a work around to get the list :

Create a saved search on the employee record with role in the search column (group) and then use search API to get this search result.

Nitish
  • 776
  • 3
  • 13
1

A successful Login request to Suitetalk (Netsuite Webservices) returns list of all roles available. http://tellsaqib.github.io/NSPHP-Doc/class_net_suite_service.html#ae54779a9faa0c0be881b5ed284c5e8b3

Saqib
  • 2,470
  • 3
  • 19
  • 32
1

There is a REST role service that can retrieve all accounts, roles and domains available for a user:

URL: https://rest.netsuite.com/rest/roles

Headers:
GET /rest/roles HTTP/1.1
Accept: */*
Accept-Language: en-us
Authorization: NLAuth nlauth_email=johnsmith@xxxxx.com, nlauth_signature=**** 

For more details, see the help documentation (Netsuite login required).

michoel
  • 3,725
  • 2
  • 16
  • 19
  • Hi Michoel, I have 91 roles in my netsuite account but i am able to fetch only 28 roles according to the given API. Can you please assist me with the same? – Mohamed Haneef Jan 17 '19 at 09:00
0
This is example  :  

$nsroleObject = new RecordRef();  
$nsroleObject->internalId = $roleId ? $roleId : $this->_accountInfo['nsrole'];  

$passPort = new Passport();  
$passPort->email = $this->_accountInfo['nsemail'];  
$passPort->password = $this->_accountInfo['nspassword'];  
$passPort->account = $this->_accountInfo['nsaccount'];  
$passPort->role = $nsroleObject;  

$loginRequest = new LoginRequest();  
$loginRequest->passport = $passPort ;  

$result = $this->netsuiteService->login($loginRequest);  
if ( !$result || !$result->sessionResponse->status->isSuccess ) {  
    return false;  
}  

// if success, update roles list    
$this->_wsRoleList = $result->sessionResponse->wsRoleList->wsRole;