search to get gl impact lines from vendor credit
# ask-stanley-ai
r
search to get gl impact lines from vendor credit
c
AI generated answer (using internal Slack threads):
To get GL impact lines from a vendor credit, you can use SuiteScript's search or SuiteQL query. Here is an example of how you can use SuiteScript's search:
Copy code
javascript
var search = require('N/search');

var glImpactSearch = search.create({
   type: 'transaction',
   filters: [
      ['type', 'anyof', 'VendCred'], // Vendor Credit
      'AND',
      ['mainline', 'is', 'F'], // Exclude mainline
      'AND',
      ['cogs', 'is', 'F'], // Exclude COGS
      'AND',
      ['shipping', 'is', 'F'], // Exclude Shipping
      'AND',
      ['taxline', 'is', 'F'] // Exclude Tax Line
   ],
   columns: [
      'line',
      'account',
      'debitamount',
      'creditamount'
   ]
});

var pagedData = glImpactSearch.runPaged({pageSize: 1000});

pagedData.pageRanges.forEach(function(pageRange){
   var page = pagedData.fetch({index: pageRange.index});
   page.data.forEach(function(result){
      log.debug({
         title: 'GL Impact Line',
         details: 'Line: ' + result.getValue({name: 'line'}) + ', Account: ' + result.getText({name: 'account'}) + ', Debit Amount: ' + result.getValue({name: 'debitamount'}) + ', Credit Amount: ' + result.getValue({name: 'creditamount'})
      });
   });
});
This script will create a search on the 'transaction' type with filters set to only return GL impact lines from Vendor Credit transactions. It will then log the line number, account, debit amount, and credit amount for each GL impact line. ****** 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.81615746
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.815387666
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.813017726
Please provide your feedback on this answer.