Chris
03/28/2025, 7:11 AMCeligo AI
03/28/2025, 7:11 AMAI generated answer (using internal Slack threads):To use search in a script to find the record id, you can use the
N/search
module in SuiteScript 2.0. Here is a basic example of how you can do this:
javascript
var search = require('N/search');
// Define search filters
var filters = [
search.createFilter({
name: 'name',
operator: <http://search.Operator.IS|search.Operator.IS>,
values: ['Your Record Name']
})
];
// Define search columns
var columns = [
search.createColumn({name: 'internalid'})
];
// Create the search
var mySearch = search.create({
type: 'customrecord_your_custom_record_type',
filters: filters,
columns: columns
});
// Run the search and process the results
mySearch.run().each(function(result) {
// Get the internal id from the search result
var internalId = result.getValue({name: 'internalid'});
log.debug('Internal ID', internalId);
return true;
});
In this example, replace 'Your Record Name'
with the name of the record you're looking for, and replace 'customrecord_your_custom_record_type'
with the script ID of your custom record type. This script will search for records of the specified type that have the specified name, and log the internal ID of each matching record.
******
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
03/28/2025, 7:12 AMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.837966084
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.831314862
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.828853667
Celigo AI
03/28/2025, 7:12 AM