Hello all,
I have come across a wierd situation. In my extension to “EPWeeklyCrewTimeEntry” screen “EP307100” I simply want to rename one of existing grid columns to match with my import excel file column name. So I have added a CacheAtached event that works fine. Column is renamed, user does normal data entry, saves and so on. The problem I am facing surfaces itself when I use “Upload” button to import from Excel. The uploads works as meant to work and imports all data correctly BUT at the end shows a dialog saying “Unable to cast object of type 'PX.Objects.CR.BAccount' to type 'PX.Objects.EP.EPEmployee'”. If I click OK I still can save the imported data without any issue but after spending couple of hours, I can’t seem to figure out why this errors is thrown at the end when everything is imported correctly. If I comment the event code I do not receive this error. I have tried both old and new syntax, tried Append, Merge and even Replace the attributes and on all of them I get the same error. This is the simple event code:
#1 Generic Method
[PXMergeAttributes(Method = MergeMethod.Append)]
[PXCustomizeBaseAttribute(typeof(PXUIFieldAttribute), nameof(PXUIFieldAttribute.DisplayName), "Employee Id")]
protected virtual void _(Events.CacheAttached<EPActivityApprove.ownerID> e) { }
#2 Traditional Method
[PXMergeAttributes(Method = MergeMethod.Append)]
[PXUIField(DisplayName = "Employee Id")]
protected virtual void EPActivityApprove_OwnerID_CacheAttached(PXCache cache) { }
Any help is apprciated.