I need a saved search to search an address by the ...
# ask-stanley-ai
l
I need a saved search to search an address by the addressbook internal id, show code and ui examples
c
AI generated answer (using internal Slack threads):
Based on the conversations, you can create a saved search to find an address by the addressbook internal id. Here is an example of how you can do this using SuiteScript:
Copy code
code
var shipaddressSearch = search.create({
    type: recordtype,
    filters: [['internalid', 'is', recordid]],
    columns: [
        search.createColumn({
            name: "internalid",
            join: "Address",
            label: "Internal ID"
        }),
        search.createColumn({
            name: "addressinternalid"
        })
    ]
})
var shipipingAddressResults = shipaddressSearch.run().getRange({
    start: 0,
    end: 1000
})
debugger;
shipipingAddressResults.forEach(function (shipaddress) {
    console.log("EXTERNAL ID", shipaddress.getValue("addressinternalid"));
    if (shipaddress.getValue("addressinternalid") == warehouseLocation) {
        warehouseLocation = shipaddress.getValue({ name: 'internalid', join: 'Address' });
    }
})
In this code, a search is created with the type of record and a filter for the internal id. The columns returned are the internal id and the address internal id. The search is then run and the results are looped through to find the address with the matching internal id. ****** 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.840153933
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.832939923
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.828293204
Please provide your feedback on this answer.