Get list of all roles in Netsuite

心已入冬 提交于 2019-12-01 11:49:18

问题


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


回答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




回答2:


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.




回答3:


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).




回答4:


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;  


来源:https://stackoverflow.com/questions/18612926/get-list-of-all-roles-in-netsuite

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!