Nathpasin Sonsetsasak (Pek)
09/25/2025, 3:44 AMCeligo AI
09/25/2025, 3:44 AMAI generated answer (using internal Slack threads):To fetch the internal ID of an employee using the employee's name in SuiteScript, you can use the
N/search module and the search.create() method. Here is a sample code snippet:
javascript
var employeeSearch = search.create({
type: search.Type.EMPLOYEE,
filters: [
['firstname', 'is', 'John'],
'and',
['lastname', 'is', 'Doe']
],
columns: ['internalid']
});
var resultSet = employeeSearch.run();
var results = resultSet.getRange({start: 0, end: 1});
if (results.length > 0) {
var employeeId = results[0].getValue({name: 'internalid'});
log.debug('Employee ID', employeeId);
}
In this example, replace 'John' and 'Doe' with the first name and last name of the employee for whom you want to fetch the internal ID. The code will return the internal ID of the employee.
******
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
09/25/2025, 3:44 AMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.801879942
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.797973692
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.79687506
Celigo AI
09/25/2025, 3:44 AM