ALAppExtensions icon indicating copy to clipboard operation
ALAppExtensions copied to clipboard

[Function Expose] InsertClientAddIns Codenit 2

Open miljance opened this issue 7 years ago • 5 comments

After Data Migration has been performed the Codeunit 2 is being triggered and if the customer has two or more companies user can get an error stating that the Add-In Table is locked by another user. The reason for this is that in Codeunit 2 Add-Ins are being insterted using function InsertClientAddIns.

We want to avoid this error and therefore we want to insert the addins using UsingPerDatabase function. Please make the function InsertClientAddIns external.

Additionally please add following publisher: OnAfterInsertClientAddIns with no parameters.

miljance avatar May 21 '19 09:05 miljance

I have found out new Problem when multiple companies exist in the Database. When Codeunit 2 is run for whatever reason the Codenit 9999 , Function EnsureUpgradeTagsAreRegisteredForNewCompany is being called. This function tries to insert Upgrade Tags which are valid per database and tries to do that for each company. Of course the error appears: 'Der Datensatz existiert bereits in der Tabelle Upgrade Tags. Identifizierende Felder und Werte: Tag='MS-281716-EXCELTEMPLATEWEBSERVICES-20180907',Company=''' transalted to english: The record already exists in the table Upgrade Tags. Identifying fields and values: Tag = 'MS-281716-EXCELTEMPLATEWEBSERVICES-20180907', Company = ''

I have the feeling this is the same problem that should be resolved. The problem occurs during migration to April Release.

miljance avatar May 22 '19 13:05 miljance

Hi miljance. Thanks for letting us know about the problem but we need to clarify a couple of things. The first one is if you find a bug in the application (or you think this is a bug) please refer to the support to create a ticket, so we can process it. The second one is InsertClientAddIns is not planned to be exposed as external at this moment. Do I understand your case correctly that you are not able to add your own add-in using normal UI for SaaS?

RomanZanizdra avatar May 28 '19 12:05 RomanZanizdra

Hi Roman,

Thank you for repsonse. Yes, I will create a ticket, no problem. At the end it turns out this should be indeed seen as a bug from my point of view.

In order to overcome this situation I asked for InsertClientAddIns to be exposed. If this is not going to be done that is also an valid reply.

How about the publisher? OnAfterInsertClientAddIns? This one is needed in order that custom AddIns can be initialised automatically. I am adressing On-Prem and Upgrade Process. Adding the AddIns manually was never a problem.

miljance avatar May 28 '19 12:05 miljance

Hi again, miljance. Thanks for collaboration. Is "OnCompanyInitialize" event good enough for your requirements? It comes after all functions in OnRun trigger and before COMMIT. It also doesn't have any conditions or if statements which can skip some cases. Can you use it or you definitely required OnAfterInsertClientAddIns event?

RomanZanizdra avatar May 28 '19 15:05 RomanZanizdra

Hi Roman,

With the currenct state OnCompanyInitialize could be used for this purpose. Add-Ins are added for the whole database and not per company and when I think about it it it may be the case that you are actually not in position to add such a Publisher without refactoring the Codeunit 2 and separating what is processed for a single company and what for the whole database. So I agree that the publisher is already present and can be used for adding our Add-Ins.

miljance avatar May 28 '19 15:05 miljance