Getting address for Xero Contacts

Good afternoon,

I’m trying to get the address information for a Xero Contact, and write it to a csv file. I am able to successfully create a csv file using

GetContacts.ForEachItem.Name + “,” + GetContacts.ForEachItem.FirstName + “,” + GetContacts.ForEachItem.LastName + “,” + GetContacts.ForEachItem.ContactID + $.System.NewLine,

When it comes to getting AdddressLine1, 2, 3, City, Region etc. I run into a brick wall. Are there any examples of how you would go about doing this please?

Hi frostie,

In Xero, the Address part of a Contact is a List of Addresses. The reason is, one can add multiple addresses to a single contact.

Thus, to get the data from the list, you can use the “ForEach” component, and loop through the addresses, getting each address’ set of values. For instance, if I am specifically looking for a POBox address my process would look like this:

The AddAddressToString Expression was:

String+$.System.NewLine+
ForEachAddress.Loop.AddressType+$.System.NewLine+
ForEachAddress.Loop.AddressLine1+$.System.NewLine+
ForEachAddress.Loop.AddressLine2+$.System.NewLine+
ForEachAddress.Loop.AddressLine3+$.System.NewLine+
ForEachAddress.Loop.AddressLine4+$.System.NewLine+
ForEachAddress.Loop.City+$.System.NewLine+
ForEachAddress.Loop.Region+$.System.NewLine+
ForEachAddress.Loop.Country+$.System.NewLine+
ForEachAddress.Loop.PostalCode

The answer I got is:

Dawie Botes With Address,Dave,B,7676ec7d-0d62-4dc0-965b-6ac1acd9ccc8

POBOX
108
PO Box
Post Office
Jordaan Park
Heidelberg
Gauteng
South Africa
1441

Thanks Dawie.

That has been a great help. Would you mind expanding on the ‘IfElse_CheckFoAddressType’ Function? I can’t work out the correct incantation!

Cheers,

Frostie

Hi frostie,

There are a lot of different ways, but mine looks like this: