Rule MacroRIS-RM-2058 – Character Limit Validation & Fix

Character Limit Validation & Fix

Automatically check selected Linnworks orders for address fields that exceed a configured character limit, store the original values in order notes, and trim the fields to the allowed length.

Long address field values can cause issues during order processing, shipping label generation, courier validation, or downstream system exports. The Address Field Character Limit Check macro helps prevent these issues by checking selected Linnworks orders and shortening specific address fields when they exceed the configured character limit.

This macro reviews each selected order, checks the City / Town, Company, and County / Region fields, and compares each field length against the configured Charcount value. If a field is too long, the macro adds an internal order note containing the original full value, trims the field to the allowed character length, and saves the updated customer address information back to the order.

With this automated approach, your team can reduce manual address cleanup, preserve the original field values for reference, and help keep orders ready for fulfilment and courier processing.

Keep order address data within accepted character limits while retaining the original values in internal order notes.

Configure the Macro

Once the app is installed, you need to create a macro configuration so the system knows which macro to run and what character limit 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.

Long city, company, or region values can create operational issues when courier systems or connected platforms have strict character limits. This macro helps reduce those issues by trimming long values and recording the original values in order notes.

How It Works

The macro checks each selected order and trims the configured address fields only when the field length is greater than the Charcount value.

Step 1

The macro starts execution and writes Macro started to the log.

Step 2

It loops through each order ID provided in the OrderIds parameter.

Step 3

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

Step 4

The macro retrieves existing order notes for the order.

Step 5

It checks the delivery address Town, Company, and Region values.

Step 6

If Town is longer than Charcount, the original value is added as an internal note and the field is trimmed to the configured length.

Step 7

If Company is longer than Charcount, the original value is added as an internal note and the field is trimmed to the configured length.

Step 8

If Region is longer than Charcount, the original value is added as an internal note and the field is trimmed to the configured length.

Step 9

If any field was changed, the macro saves the updated order notes and customer address information back to the order.

Step 10

The macro logs whether customer information was changed or whether no change was required.

Usage of App

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

OrderIds

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

Charcount

Defines the maximum number of characters allowed for the checked address fields.

City / Town Check

Checks the delivery address Town value and trims it if the value exceeds the configured character limit.

Company Check

Checks the delivery address Company value and trims it if the value exceeds the configured character limit.

County / Region Check

Checks the delivery address Region value and trims it if the value exceeds the configured character limit.

Internal Notes

Adds internal order notes containing the original full values before trimming any field.

Order Update Behaviour

The macro saves customer information back to the order only when at least one checked field exceeds the configured character limit.

Execution Logging

The macro records field lengths, changed fields, saved notes, customer information updates, errors, and completion using the macro logger.

Key Points to Remember

  • The macro processes only the order IDs provided in OrderIds

  • The Charcount parameter controls the maximum allowed character length

  • The macro checks Town, Company, and Region on the delivery address

  • Billing address fields are not updated by this macro

  • If a field exceeds Charcount, the original value is stored in an internal order note

  • The field is then trimmed using the first characters up to the configured Charcount

  • Orders are updated only when at least one checked field exceeds the limit

  • The macro uses internal notes created by CheckAndUpdateDataCharwise Macro

  • Address fields should contain values before the macro runs to avoid missing-field issues

Once the macro is running, it helps keep selected address fields within the configured character limit while preserving original values for reference.

What You Can Expect

  • Selected orders are checked automatically
    The macro reviews each order passed into the OrderIds parameter

  • Long city or town values are trimmed
    The delivery address Town field is shortened when it exceeds the configured character limit

  • Long company values are trimmed
    The delivery address Company field is shortened when it exceeds the configured character limit

  • Long region values are trimmed
    The delivery address Region field is shortened when it exceeds the configured character limit

  • Original values are saved
    The full original values are stored in internal order notes before being trimmed

  • Execution is logged
    The macro records field lengths, changes made, notes saved, and any errors

Overall Impact

This macro improves address data consistency, reduces manual cleanup, and helps prevent courier or export issues caused by address fields that exceed accepted character limits.

What To Do After the Macro Runs

After the macro has completed, review updated orders if needed to confirm that long address fields were trimmed and that the original full values were saved in internal notes.

Steps to Follow

Step 1

Open Linnworks and locate the orders included in the OrderIds parameter.

Step 2

Review the delivery address Town, Company, and Region values.

Step 3

Confirm that any field longer than Charcount was trimmed to the configured length.

Step 4

Review internal order notes to confirm that original full values were stored.

Step 5

Continue with normal order validation, label generation, picking, packing, or dispatch processing.

Why This Matters

Keeping address fields within character limits helps:

  • Reduce courier validation issues

  • Prevent export or integration errors

  • Avoid manual address cleanup

  • Preserve original address values for reference

  • Improve order processing accuracy

  • Keep fulfilment workflows moving smoothly

Best Practices

To get the most value from this macro, configure the character limit according to the strictest system or courier requirement in your workflow.

  • Use the correct character limit
    Set Charcount based on the maximum field length accepted by your courier, channel, or downstream system

  • Review selected orders carefully
    Make sure the correct order IDs are passed into the macro before running it

  • Check notes after execution
    Review internal notes if you need to see the original full value before trimming

  • Run before dispatch
    Use the macro before label generation so address data is corrected before courier validation

  • Avoid running on incomplete address data
    Confirm that Town, Company, and Region values are populated where required

  • Test with sample orders first
    Run the macro on a small set of test orders before applying it to a wider workflow

Correct address field lengths help reduce validation problems and keep dispatch processing smooth.

Example Scenario

To better understand how this works, here’s a simple example:

Configured value:

  • Charcount = 20

Selected orders:

  • Order A has Town value Very Long City Name Example → The original value is added to an internal note, and Town is trimmed to Very Long City Name

  • Order B has Company value Example Company Name That Is Too Long → The original value is added to an internal note, and Company is trimmed to the first 20 characters

  • Order C has Region value Greater Metropolitan Region Name → The original value is added to an internal note, and Region is trimmed to the first 20 characters

  • Order D has Town, Company, and Region values within 20 characters → No update is made

What This Means

  • Only fields longer than the configured character limit are changed

  • Original values are preserved in internal notes

  • Updated address fields contain only the allowed number of characters

  • Your team can continue processing orders without manually shortening each field

Final Summary

The Address Field Character Limit Check macro helps keep selected Linnworks orders compatible with character length requirements by checking delivery address fields and trimming values that exceed the configured Charcount.

By storing original full values in internal order notes, updating only long fields, and saving corrected customer address information, this macro supports cleaner address data and smoother fulfilment processing.