Rob
11/15/2024, 5:34 PMCeligo AI
11/15/2024, 5:34 PMAI generated answer (using internal Slack threads):To get the vendor credit from a Vendor Payment with a search, you would need to perform a search on the 'Vendor Payment' record type. Unfortunately, the 'Vendor Payment' record does not directly link to the 'Vendor Credit' record. However, you can retrieve the 'Vendor Credit' record through the 'Apply' record type. The 'Apply' record type represents the application of a 'Vendor Payment' to a 'Vendor Bill' or a 'Vendor Credit'. You can filter the 'Apply' records by the 'Vendor Payment' internal ID and then retrieve the 'Vendor Credit' internal ID from the 'Apply' records. Here is a sample SuiteScript 2.0 search:
javascript
var search = require('N/search');
var applySearch = search.create({
type: 'apply',
filters: [
['type', 'anyof', 'VendPymt']
],
columns: [
'internalid',
'createdfrom',
'appliedtotransaction'
]
});
applySearch.run().each(function(result) {
// Log the internal ID of the Vendor Credit
log.debug({
title: 'Vendor Credit Internal ID',
details: result.getValue('appliedtotransaction')
});
return true;
});
In this script, the 'type' filter is used to only retrieve 'Apply' records that are associated with 'Vendor Payments'. The 'appliedtotransaction' column represents the 'Vendor Credit' that the 'Vendor Payment' is applied to.
Please note that this script only logs the internal ID of the 'Vendor Credit'. You may need to load the 'Vendor Credit' record to retrieve additional information.
******
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
11/15/2024, 5:35 PMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.856841147
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.855371714
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.850612879
Celigo AI
11/15/2024, 5:35 PM