Proper Way To Validate Addresses

Is there a proper way to validate if an address already exists as part of an external integration process? I know we need to use the AddressFull attribute but since this is generated by the platform, how would an external integration that calls a logic block be able to generate this AddressFull for comparison?

Also a customer has an issue with AddressFull causing problems as well. They are receiving a duplicate key error when attempting to integrate the following address: 229 SOFIA LANE LAKE ALFRED FL 33850 USA

Attempting to insert/update the record in the Customers and Contacts → Addresses child table.

The issue arises because:

  • Address 1:

    • AddressLine1 = 229 SOFIA LANE LAKE

    • AddressCity = ALFRED

  • Address 2:

    • AddressLine1 = 229 SOFIA LANE

    • AddressCity = LAKE ALFRED

Although the AddressLine1 and City fields differ between the two records, when concatenated into the Address_Full field, both result in the same value. As a result, the system validates against the Address_Full value and throws a duplicate key error when attempting to create the second address.

Take a look at this thread - Comparing addresses - #2 by ian.p

It seems to me like comparing those two addresses should result in a duplicate found if I’m understanding PN-25.1.07-[Nextbot]-5250 correctly and the comparison uses the expected logic block action.

So … are these different addresses or the same address? Should a duplicate error happen or should it not?

It feels like you might be wanting to persist bad data from an old system into Nextworld and a Nextworld validation that prevents this is blocking you.

I suspect same address entered in the host system differently but when we do a fetch to the Addresses table by each of the individual address components, the fetch will not find a record and call WriteAddress which is using AddressFull as the comparison, which is something our integration code doesn’t have so WriteAddress will try to create a new address record but we get stopped with a duplicate address error. If we had a way to generate AddressFull on the fly in our logic block, we would find a match and not continue with trying to insert a new address.

The only way I know how generate AddressFull without manually concatenating the individual components is call a new logic block in a new DB transaction that writes the address to a main table and then fetch the main table in my calling logic block to get the AddressFull for comparision.

If you use a conditional, even with an address that doesn’t already exist in the DB, the AddressFull will get determined on the fly which can be nice if you’re comparing to an already known address. However the problem for you I think is, per this post, you really want to fetch from the DB with a computed address full to see if a dupe already exists with that AddressFull, not just do a comparison after you’ve already done the fetch.