SQL to get vendor records with changes to address ...
# ask-stanley-ai
n
SQL to get vendor records with changes to address field from system notes
c
AI generated answer (using internal Slack threads):
To get vendor records with changes to the address field from system notes, you would need to use SuiteScript's N/search or N/query module to search the system notes for the vendor record. Here is a sample code snippet that you can use as a starting point:
Copy code
javascript
var search = require('N/search');

var systemNotesSearch = search.create({
    type: search.Type.SYSTEM_NOTE,
    filters: [
        ['recordtype', 'is', search.Type.VENDOR],
        'and',
        ['name', 'is', 'Address']
    ],
    columns: ['record', 'date', 'name', 'newvalue', 'oldvalue']
});

systemNotesSearch.run().each(function(result) {
    // Process each result
    return true; // Continue to next result
});
This script creates a search on the system notes, filtering for vendor records where the 'name' field is 'Address'. It then retrieves the 'record', 'date', 'name', 'newvalue', and 'oldvalue' columns for each matching system note. Please note that this script will only capture changes to the default billing address. If a user changes another address (e.g., the shipping address) on the vendor record, it won't show up in the system notes. Also, if a user creates a new address and assigns it as the default, or changes an existing address and assigns it as the default, these changes will not be captured in the system notes. ****** 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.842757583
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.831411
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.830121279
Please provide your feedback on this answer.