user2739843
user2739843

Reputation: 67

Get list of all roles in Netsuite

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

Upvotes: 2

Views: 4719

Answers (4)

Saqib
Saqib

Reputation: 2480

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

Upvotes: 1

michoel
michoel

Reputation: 3783

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 [email protected], nlauth_signature=**** 

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

Upvotes: 1

Nitish
Nitish

Reputation: 796

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.

Upvotes: 4

caophamtruongson
caophamtruongson

Reputation: 13

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;  

Upvotes: 0

Related Questions