create an ad-hoc search in suitescript 2.x for tra...
# ask-stanley-ai
j
create an ad-hoc search in suitescript 2.x for transactions with account type of account receivable and last modified date of today. include columns of the linked customer internal id
c
AI generated answer (using internal Slack threads):
To create an ad-hoc search in SuiteScript 2.x for transactions with account type of account receivable and last modified date of today, and include columns of the linked customer internal id, you can use the
search
module of SuiteScript 2.x. Here is a sample code snippet:
Copy code
javascript
var search = require('N/search');

var transactionSearch = search.create({
   type: search.Type.TRANSACTION,
   filters: [
      ['type', 'anyof', 'CustInvc'], // Customer Invoice
      'AND',
      ['accounttype', 'anyof', 'AcctRec'], // Account Receivable
      'AND',
      ['lastmodifieddate', 'on', 'today']
   ],
   columns: [
      search.createColumn({
         name: 'internalid',
         join: 'customer'
      })
   ]
});

var searchResult = transactionSearch.run().getRange({
   start: 0,
   end: 100
});

for (var i = 0; i < searchResult.length; i++) {
   var customerInternalId = searchResult[i].getValue({
      name: 'internalid',
      join: 'customer'
   });
   log.debug('Customer Internal ID', customerInternalId);
}
This script creates a search on transactions of type 'Customer Invoice' with account type 'Account Receivable' and last modified date of today. It includes the internal id of the linked customer in the search results. The search results are then looped through to log the internal id of each linked customer. ****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ******
Slack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.82768929
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.819870234
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.818916798
Please provide your feedback on this answer.