how to get only item receipt transactions in query
# ask-stanley-ai
h
how to get only item receipt transactions in query
c
AI generated answer (using internal Slack threads):
To get only item receipt transactions in a query, you can use the 'type' field in the transaction record to filter out only item receipt transactions. Here is an example of how you can do this in SuiteScript:
Copy code
javascript
var search = require('N/search');

var transactionSearch = search.create({
   type: search.Type.TRANSACTION,
   filters: [
      ['type', search.Operator.ANYOF, 'ItemRcpt']
   ],
   columns: ['tranid', 'trandate', 'entity', 'total']
});

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

for (var i = 0; i < searchResult.length; i++) {
   var tranid = searchResult[i].getValue({
      name: 'tranid'
   });
   var trandate = searchResult[i].getValue({
      name: 'trandate'
   });
   var entity = searchResult[i].getValue({
      name: 'entity'
   });
   var total = searchResult[i].getValue({
      name: 'total'
   });

   log.debug('tranid', tranid);
   log.debug('trandate', trandate);
   log.debug('entity', entity);
   log.debug('total', total);
}
In this example, the 'type' filter is set to 'ItemRcpt' which corresponds to item receipt transactions. The columns 'tranid', 'trandate', 'entity', and 'total' are then retrieved for each item receipt transaction. ****** 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.808785737
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.803907216
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.803402543
Please provide your feedback on this answer.