# How to Insert both a Primary and Business to a new customer via Logic Block

**URL:** <https://community.nextw.com/t/how-to-insert-both-a-primary-and-business-to-a-new-customer-via-logic-block/910>\
**Category:** Nextworld Platform\
**Tags:** logic-blocks\
**Created:** [July 30, 2025, 2:11am UTC](https://community.nextw.com/t/how-to-insert-both-a-primary-and-business-to-a-new-customer-via-logic-block/910 "2025-07-30T02:11:15Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![david.lee](https://sea1.discourse-cdn.com/flex001/user_avatar/community.nextw.com/david.lee/32/331_2.png) [@david.lee](https://community.nextw.com/u/david.lee)\
**Post date:** [July 30, 2025, 2:11am UTC](https://community.nextw.com/t/how-to-insert-both-a-primary-and-business-to-a-new-customer-via-logic-block/910/1 "2025-07-30T02:11:15Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![brendan.b](https://sea1.discourse-cdn.com/flex001/user_avatar/community.nextw.com/brendan.b/32/269_2.png) [@brendan.b](https://community.nextw.com/u/brendan.b)\
**Post date:** [August 1, 2025, 7:14pm UTC](https://community.nextw.com/t/how-to-insert-both-a-primary-and-business-to-a-new-customer-via-logic-block/910/2 "2025-08-01T19:14:58Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![david.lee](https://sea1.discourse-cdn.com/flex001/user_avatar/community.nextw.com/david.lee/32/331_2.png) [@david.lee](https://community.nextw.com/u/david.lee)\
**Post date:** [August 1, 2025, 10:12pm UTC](https://community.nextw.com/t/how-to-insert-both-a-primary-and-business-to-a-new-customer-via-logic-block/910/3 "2025-08-01T22:12:26Z")

</div>

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.

 ![image (4)](https://us1.discourse-cdn.com/flex001/uploads/nextworld/original/1X/5ff1a7d28f69a64f2dfa7b84208ce253859e338b.png)

---

<div class="post-metadata">

**Author:** ![brendan.b](https://sea1.discourse-cdn.com/flex001/user_avatar/community.nextw.com/brendan.b/32/269_2.png) [@brendan.b](https://community.nextw.com/u/brendan.b)\
**Post date:** [August 4, 2025, 1:21pm UTC](https://community.nextw.com/t/how-to-insert-both-a-primary-and-business-to-a-new-customer-via-logic-block/910/4 "2025-08-04T13:21:31Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![ian.p](https://sea1.discourse-cdn.com/flex001/user_avatar/community.nextw.com/ian.p/32/427_2.png) [@ian.p](https://community.nextw.com/u/ian.p)\
**Post date:** [August 4, 2025, 1:26pm UTC](https://community.nextw.com/t/how-to-insert-both-a-primary-and-business-to-a-new-customer-via-logic-block/910/5 "2025-08-04T13:26:38Z")

</div>

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.

 ![image](https://us1.discourse-cdn.com/flex001/uploads/nextworld/original/1X/3015ad5f8ce116e6c8f90cdc7b7e29a3ab6a9f04.jpeg)

---

<div class="post-metadata">

**Author:** ![david.lee](https://sea1.discourse-cdn.com/flex001/user_avatar/community.nextw.com/david.lee/32/331_2.png) [@david.lee](https://community.nextw.com/u/david.lee)\
**Post date:** [August 5, 2025, 5:11am UTC](https://community.nextw.com/t/how-to-insert-both-a-primary-and-business-to-a-new-customer-via-logic-block/910/6 "2025-08-05T05:11:44Z")

</div>

Yeah, what you said makes sense. Thanks.

---

<div class="post-metadata">

**Author:** ![david.lee](https://sea1.discourse-cdn.com/flex001/user_avatar/community.nextw.com/david.lee/32/331_2.png) [@david.lee](https://community.nextw.com/u/david.lee)\
**Post date:** [August 5, 2025, 5:12am UTC](https://community.nextw.com/t/how-to-insert-both-a-primary-and-business-to-a-new-customer-via-logic-block/910/7 "2025-08-05T05:12:55Z")

</div>

Yeah, I figured out from reading existing logic blocks that make use of the WriteAddress and the AddressCrossReference table. Thanks.
