ANS-0835 · WEB SERVICES & INTEGRATIONS
How to Access Employee Information from the NetSuite Partner Center?
By linking partner and employee records with a custom field, NetSuite users can programmatically retrieve employee details within the Partner Center.
Short answer
To access employee information from the Partner Center, first create a custom 'Linked Employee' field on the Partner record, linking it to the Employee record. Within the Partner Center, use SuiteScript to obtain the current partner's ID. Then, retrieve the associated employee ID from the custom field and load the employee record to access its details.
Scenario
NetSuite's Partner Center does not directly provide access to employee records. Organizations often need to associate specific employee information with their partner records and retrieve these details when operating within the Partner Center. This presents a challenge when direct access to employee data is required for partner-related processes.
Solution
To enable access to employee information from the Partner Center, implement the following steps:
On the Partner record, add a custom field, for example, named "Linked Employee". This field should be of type List/Record and linked to the Employee record.
Within the Partner Center environment, utilize SuiteScript 2.x to obtain the current user's context and retrieve the partner ID.
javascript
// Assuming N/runtime module is loaded as 'runtime'
var currentUser = runtime.getCurrentUser();
var partnerId = currentUser.id;Using the retrieved partnerId, load the Partner record to extract the employeeID from the custom "Linked Employee" field.
javascript
// Assuming N/record module is loaded as 'record'
var partnerRecord = record.load({
type: record.Type.PARTNER,
id: partnerId,
isDynamic: false
});
var employeeId = partnerRecord.getValue({
fieldId: 'custentity_linked_employee' // Replace with your custom field ID
});Once the employeeId is obtained, load the corresponding Employee record to access its information.
javascript
// Assuming N/record module is loaded as 'record'
if (employeeId) {
var employeeRecord = record.load({
type: record.Type.EMPLOYEE,
id: employeeId,
isDynamic: false
});
// Employee record details can now be accessed
}Expert NetSuite Support
Need help with this NetSuite issue?
Web Services & Integrations consulting and configuration support
