I have a logic block that is invoked in a REST integration and I need to write a primary address and a business address to a customer. Is there any sample code that I can look at?
I don’t know of any examples offhand but this should be easy to accomplish just with a Insert Record action. In your logic block, you can map inputs to individual fields on the record as you invoke Insert Record. For the most part, you should be able to just assign the input Address to the appropriate field on your inserted record and it will work fine.
If you need anything more complicated, you can create a New Variable of type Address using Set Values. From there, you can use Set Values to assign the whole Address at once or individual parts of it (e.g. Street, Country, etc.) one at a time. If needed, you can use the Text Manipulation action to convert between address formats.
I have two Address objects: PrimaryAddress and BillingAddress. I am to save the PrimaryAddress using the below logic. However, I don’t find a way to do it for additional address.
The problem is that the Directory table only has a PrimaryAddress field on it, so you have nowhere to store your BillingAddress? I would recommend Customizing or Extending the Directory table to add an additional field to it. Customizing will work best if you are a customer using the product directly, Extending will work best if you are a partner developing your own solution to be used by other people.
I think you want to investigate calling WriteAddress logic block. It has detailed instructions on how to call it and attach different types of addresses to contacts as cross references from the Directory to the Addresses table. The PrimaryAddress field is the only one that is duplicated onto the directory record, all the others are maintained in a separate table and linked to the directory by the AddressCrossReference table.
Yeah, what you said makes sense. Thanks.
Yeah, I figured out from reading existing logic blocks that make use of the WriteAddress and the AddressCrossReference table. Thanks.

