Shelby Owens
04/02/2025, 2:17 PMCeligo AI
04/02/2025, 2:18 PMAI generated answer (using internal Slack threads):****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ****** To accomplish your task, you can use a Scheduled SuiteScript. This script will run daily and check if the current date matches the date in the custom date field on the customer record. If it does, the script will update the price level of that customer. Here is a basic example of how you could structure this script:
javascript
/**
* @NApiVersion 2.x
* @NScriptType ScheduledScript
*/
define(['N/record', 'N/search'], function(record, search) {
function execute(context) {
var today = new Date();
today.setHours(0,0,0,0); // to remove time from date
var customerSearch = search.create({
type: search.Type.CUSTOMER,
filters: [['custentity_your_custom_date_field', 'on', today]]
});
customerSearch.run().each(function(result) {
var customerId = result.id;
try {
record.submitFields({
type: record.Type.CUSTOMER,
id: customerId,
values: {
pricelevel: 'internalid_of_new_price_level'
}
});
log.debug('Customer Updated', customerId);
} catch (e) {
log.error('Error Updating Customer', e);
}
return true; // to continue the search
});
}
return {
execute: execute
};
});
Please replace 'custentity_your_custom_date_field'
with the script id of your custom date field and 'internalid_of_new_price_level'
with the internal id of the new price level.
Remember to deploy this script as a Scheduled Script in NetSuite and schedule it to run daily.
Please note that this is a basic example and might need to be adjusted to fit your specific needs. Always test scripts in a sandbox environment before deploying them in a live environment.Celigo AI
04/02/2025, 2:18 PMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.829473734
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.828138351
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.827588141
Celigo AI
04/02/2025, 2:18 PM