Rule MacroRIS-RM-2212 – Missing Town & Region Fix

Missing Town & Region Fix

Automatically update selected Linnworks orders when customer delivery or billing address region and town fields are missing.

Incomplete address information can delay order validation, fulfilment, and courier processing. The No Empty Region macro helps keep selected order address data complete by applying a defined region value where required.

This macro checks each selected order and reviews the customer delivery and billing address details. When the order needs updating, the macro fills missing Region fields with the configured RegionName value. If a Town field is missing, the macro fills it using the relevant address Region value.

With this automated approach, your team can reduce manual address corrections, improve order data consistency, and prepare selected orders for smoother downstream processing.

Keep selected order address information complete by automatically filling missing Region and Town values.

Configure the Macro

Once the app is installed, you need to create a macro configuration so the system knows which macro to run and which default region value should be applied.

This setup can be adjusted anytime based on your operational requirements.

Steps to Configure

Go to Apps > Macro Configuration and click + Add new configuration.

Missing Region or Town values can cause address validation issues, especially when external services require complete location information. This macro helps reduce those issues by automatically correcting selected orders.

How It Works

The macro checks each selected order and updates missing delivery or billing address fields only when the order qualifies for correction.

Step 1

The macro starts execution and writes Macro Started: Fetching All the Order Id to the log.

Step 2

It checks whether any OrderIds were provided. If no order IDs are provided, the macro logs the issue and stops.

Step 3

It checks whether RegionName has a value. If RegionName is empty, the macro logs that the region name is required and stops.

Step 4

For each selected order, the macro retrieves the order details using the Linnworks Orders API.

Step 5

The macro checks the delivery address. If both delivery Town and Region are already available, the order is marked as already having complete address information.

Step 6

The macro checks the billing address. If both billing Town and Region are already available, the order is also marked as already having complete address information.

Step 7

If either address check marks the order as already complete, the macro skips that order and moves to the next selected order.

Step 8

If the order is not skipped, the macro fills any empty delivery Region field with RegionName.

Step 9

If the delivery Town field is empty, the macro sets it to the delivery Region value.

Step 10

The same checks are applied to the billing address: empty billing Region is filled with RegionName, and empty billing Town is filled using the billing Region value.

Step 11

The macro saves the updated customer information back to the order.

Step 12

The macro logs any errors and writes Macro finished when execution ends.

Usage of App

This macro is designed to update selected orders automatically once the required RegionName parameter is configured. It is useful before dispatch, during order validation, or whenever selected orders need address data cleanup.

OrderIds

Defines the Linnworks order IDs that should be processed. Only these selected orders are checked and updated.

RegionName

Defines the default region value that will be applied when a delivery or billing address has an empty Region field.

Town Update Behaviour

If a Town field is empty, the macro fills it using the relevant address Region value.

Skip Behaviour

If the delivery address already has both Town and Region, or the billing address already has both Town and Region, the macro skips the order.

Execution Logging

The macro records start, validation, skipped order, update, error, and completion messages using the macro logger.

Key Points to Remember

  • The macro processes only the order IDs provided in OrderIds

  • RegionName is required

  • Missing delivery and billing Region values are filled with RegionName

  • Missing delivery and billing Town values are filled using the relevant Region value

  • If either the delivery address or billing address already has both Town and Region, the order is skipped

  • Existing populated address values are not overwritten

  • The macro saves updates using SetOrderCustomerInfo

Once the macro is running, it helps ensure selected orders have the basic address region and town information required for smoother order handling.

What You Can Expect

  • Missing Region values are automatically updated

    Empty delivery and billing Region fields are filled using the configured RegionName value.

  • Missing Town values are automatically updated

    Empty delivery and billing Town fields are filled using the relevant Region value.

  • Orders with complete address data are skipped

    The macro avoids changing orders when address information is already complete based on the configured logic.

  • Execution details are logged

    The macro logs start, validation messages, updated orders, errors, and completion.

dummy region name

Use a dummy region name like:

RegionName: England

Other safe dummy examples:

RegionName: London RegionName: Greater London RegionName: Default Region RegionName: United Kingdom

For testing, I would use:

RegionName: Default Region