James Morris
08/06/2025, 4:29 PMCeligo AI
08/06/2025, 4:29 PMAI generated answer (using internal Slack threads):Based on the conversations, here is a sample of a Map/Reduce script in SuiteScript 2.1 that searches all transactions records with an account type of Accounts Payable. For each linked customer associated with those transactions, it sets the
custentity_paymentstatus
value to 1.
javascript
/**
* @NApiVersion 2.1
* @NScriptType MapReduceScript
*/
define(['N/search', 'N/record'], function(search, record) {
function getInputData() {
return search.create({
type: 'transaction',
filters: [
['accounttype', 'anyof', 'AccountsPayable']
],
columns: ['internalid']
});
}
function map(context) {
var searchResult = JSON.parse(context.value);
var transactionId = searchResult.id;
var transactionRecord = record.load({
type: 'transaction',
id: transactionId
});
var customerId = transactionRecord.getValue('entity');
if (customerId) {
record.submitFields({
type: 'customer',
id: customerId,
values: {
custentity_paymentstatus: 1
}
});
}
}
return {
getInputData: getInputData,
map: map
};
});
This script first creates a search that retrieves all transactions with an account type of Accounts Payable. In the map stage, it loads each transaction record, retrieves the linked customer, and sets the custentity_paymentstatus
field to 1.
******
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
08/06/2025, 4:29 PMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.845565081
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.837756455
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.833273828
Celigo AI
08/06/2025, 4:29 PM