Extend Address Line length

Hi Everyone,

Extending of field length in Acumatica is not a trivial task, so here I want to publish guidance on how I usually do that.

To extend field we need to do 2 things:

  • Extend allowed length in DAC attribute
  • Extend length of Database Column

Welcome under the cut for more details

Extend Field in the DAC
Here you need to find PXDBStringAttribute and redefine it. Allowed field length is passed in constructor so unfortunately you cannot easily change it with PXCustomizeBaseAttribute. In the end you have 2 ways:

  • Redefine all attributes –
    • [PXDBString(200, IsUnicode = true)]
    • [PXUIField(DisplayName = “Address Line 1”, Visibility = PXUIVisibility.SelectorVisible)]
    • [PXMassMergableField]
  • Remove Specific attribute and add if again –
    • [PXRemoveBaseAttribute(typeof(PXDBStringAttribute))]
    • [PXDBString(200, IsUnicode = true)]

I think second way is better as here you have less changes in the base code.

Extend DB column <
The biggest complexity here is that Acumatica Customization browser not yet allow to extend DB field, so even if you add column with same name and longer lengh it will not be extended in DB as field has been created already.

Correct way will be to write an update script against DB:

alter table Address alter column AddressLine1 Nvarchar(200) null

That is it. Now you can publish customization and use extended field.
Few Important notes about fields length:

  1. Acumatica upgrade procedure will not shrink database column if its length is longer, but it will extend it if the length is shorter than defined in Acumatica schema.
  2. Acumatica Snapshots cannot detect extended fields so you have to apply customization before you can import snapshot with extended field to new instance.
  3. Field Update script can be executed and on MS SQL and on MySQL the same way.
  4. In case you have depended or copied fields you will need to extend their length as well. For example Billing and Shipping address is copied from customer to special tables in AR/AP/PO/SO and other modules, so you have to extend other AddressLine1 as well. I recommend to search for address line in whole database. Do the same for DACs.

Have a nice Development!

2 Replies to “Extend Address Line length”

    1. Hi Freeman, it is a bit hard to say what happens without a debugger… Could you please create a support ticket so our support team can check your code?

Leave a Reply

Your email address will not be published. Required fields are marked *