# How to handle AL0155 (object already defined) without using "Next Major Version" option in Extension Management

**URL:** <https://www.dynamicsuser.net/t/how-to-handle-al0155-object-already-defined-without-using-next-major-version-option-in-extension-management/76089>\
**Category:** Developers Forum\
**Created:** [April 4, 2022, 8:32pm UTC](https://www.dynamicsuser.net/t/how-to-handle-al0155-object-already-defined-without-using-next-major-version-option-in-extension-management/76089 "2022-04-04T20:32:40Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![JayM](https://avatars.discourse-cdn.com/v4/letter/j/2bfe46/32.png) [@JayM](https://www.dynamicsuser.net/u/JayM)\
**Post date:** [April 4, 2022, 8:32pm UTC](https://www.dynamicsuser.net/t/how-to-handle-al0155-object-already-defined-without-using-next-major-version-option-in-extension-management/76089/1 "2022-04-04T20:32:40Z")

</div>

In Version 20, “Sales Invoice” has added the “Customer Posting Group” field. This field has been previously added by an extension in version 19 with a page extension.

Exact error:  
A member of type Field with name ‘Customer Posting Group’ is already defined in Page ‘Sales Invoice’ by the extension ‘Base Application by Microsoft (20.0.37253.38454)’.AL[AL0155](https://docs.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/diagnostics/diagnostic-al155)

This was caused by the code below. (From Version 19.\*)

```auto
        addafter("Pmt. Discount Date")
        {
            field("Customer Posting Group"; Rec."Customer Posting Group")
            {...}
        }

```

The previous solution was to remove or change the field to a “modify” and to manually deploy the extension with “Next Major Version”. I started to modify Publish-PerTenantExtensionApps in the BC-ContainerHelper to support “Next Major Version” but that is still a work in progress.

Is there an alternative?  
I haven’t been able to figure out how to use the preprocessor directives to handle this. I can’t use the directives set by the base application. Example: #if not CLEAN20.

Is there some way to reference the base app preprocessor directives? Some other easy button I overlooked?

---

<div class="post-metadata">

**Author:** ![Bert\_Verbeek](https://sea1.discourse-cdn.com/flex023/user_avatar/www.dynamicsuser.net/bert_verbeek/32/7802_2.png) [@Bert\_Verbeek](https://www.dynamicsuser.net/u/Bert_Verbeek)\
**Post date:** [April 5, 2022, 11:02am UTC](https://www.dynamicsuser.net/t/how-to-handle-al0155-object-already-defined-without-using-next-major-version-option-in-extension-management/76089/2 "2022-04-05T11:02:50Z")

</div>

You cannot set the preprocessor for the base app indeed.  
MS can only do that.  
So the only solution is to modify your extension.

---

<div class="post-metadata">

**Author:** ![teddyh](https://sea1.discourse-cdn.com/flex023/user_avatar/www.dynamicsuser.net/teddyh/32/7909_2.png) [@teddyh](https://www.dynamicsuser.net/u/teddyh)\
**Post date:** [April 5, 2022, 7:41pm UTC](https://www.dynamicsuser.net/t/how-to-handle-al0155-object-already-defined-without-using-next-major-version-option-in-extension-management/76089/3 "2022-04-05T19:41:40Z")

</div>

Nothing that I know.  
When adding existing field to page, make sure you add your prefix or suffix. This will prevent your app from failing to upgrade.

addafter(“Pmt. Discount Date”)  
{  
field(“PFX\_Customer Posting Group”; Rec.“Customer Posting Group”)  
{…}  
}

---

<div class="post-metadata">

**Author:** ![JayM](https://avatars.discourse-cdn.com/v4/letter/j/2bfe46/32.png) [@JayM](https://www.dynamicsuser.net/u/JayM)\
**Post date:** [April 6, 2022, 4:38pm UTC](https://www.dynamicsuser.net/t/how-to-handle-al0155-object-already-defined-without-using-next-major-version-option-in-extension-management/76089/4 "2022-04-06T16:38:33Z")

</div>

Your comment did give me an Idea…

Rename the Field

I incorrectly made the assumption a single field could not exist on a page at the same time. And that field name changes on a Production deployment would be rejected due to compatibility requirements. Disclaimer: This is PTE, so I have not tested this on AppSource.

Just ran a test, and I was able to put the Customer Posting Group on the Sales Invoice form 3 times with different field names. Edits still work and all fields stay synchronized. And I was also able to simply rename those same fields and redeploy.

Simply adding the prefix on this field prior to V20 should suffice. Once the next major version rolls out, I can then remove the duplicate custom field completely.

This maintains functionality for the users during the entire process.
