How can I find the TRANSACTIONSHIPPINGADDRESS reco...
# ask-stanley-ai
d
How can I find the TRANSACTIONSHIPPINGADDRESS record when I have the internalid of the addressbook?
c
AI generated answer (using internal Slack threads):
To find the TRANSACTIONSHIPPINGADDRESS record when you have the internalid of the addressbook, you need to understand that there are two internal ids associated with an address. One is the internal id of the address subrecord, named
internal id
in searches, and the other is the internal id of the address book line from the entity, named
address internal id
in searches. The shipping address list uses the internal id of the address book. You can't load the address record directly because it is a subrecord. You would need to load the Sales Order customer and from there load the address record. You can create a search to get what you need too, but it's not straightforward. Here is a code sample that was provided in the threads:
Copy code
javascript
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("EXTRENAL IDDDD", shipaddress.getValue("addressinternalid"));
  if (shipaddress.getValue("addressinternalid") == warehouseLocation) {
    warehouseLocation = shipaddress.getValue({ name: 'internalid', join: 'Address' });
  }
})
This code creates a search of the customer addressinternalid as a column compares and added the internal id with a join to get the address 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.846723735
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.842313826
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.837956071
Please provide your feedback on this answer.