I know this has been discussed before and I found a few posts, but just checking what the most up-to-date workaround is for this. @hkeric.wci refers to using Epicor Functions as a fix on an older post, but it is in EFx that I’m getting the issue.
I’ve got an EFx Library that contains multiple functions. One iterates over UD07 table to find rows that indiciate I want to create a cycle count schedule for a site. It’s a multi site environment.
Function to create the Cycle Count Schedule is fine, that works. I’ve got another that follows that first one and calls “Peform Part Selection” and this works well too. I ran into this error when calling the “Generate Tags” as it’s in a different BO.
The error is:
The type ‘CCHdrRow’ exists in both ‘Erp.Contracts.BO.CCCountCycle, Version=11.3.100.0, Culture=neutral, PublicKeyToken=5d3fa3c7105d7992’ and ‘Erp.Contracts.BO.CCSchedule, Version=11.3.100.0, Culture=neutral, PublicKeyToken=5d3fa3c7105d7992’
Epicor were doing something with “extern alias” on client side C# customisations, that’s documented in Experts Corner. Doesn’t seem to be translatable to EFx directly.
Correct me if I’m wrong, but wasn’t the fix to segregate BO’s by calling a separate function instead of having both BO’s in the same function? Is that what you are doing?
I’ve got them in separate functions, but they do exist within the same library currently. The references are at the library level, so I can see why that it’s a problem.
Being purist I don’t really want to separate out this one single function into a new library, because to me a library should contain all of the related functions…!
Agreed! But I would think that wrapped in a using statement (or call service statement in functions) It would keep those separate, even if it’s in the same function library. That’s dumb.
I have worked around this recently with Serial Numbers.
Instead of doing;
var VarName = new Erp.Tablesets.CCHdrRow();
do
var varName = tsCCCountCycle.CCHdr.NewRow();
You do lose access to the field names, but you can access them with [“”]. But it does compile and work.
And i suppose if you wanted the field names for further code you could always add the row to your tableset and get it back out into a new variable through Linq.
Since the rows are just held in a List, you know the Add puts the added row at the end of the List, so the Last() LINQ method will get you that. Now you can use ccHdrRow and access its typed columns as usual.
Epicor Function libraries are DLLs and are built as a C# project. If you were writing code in a C# project, you could add an alias to one of the assembly references and then use “extern alias” in your class.
Unfortunately, there is no way for you to do this in Epicor Functions as there is no way to assign an alias to an assembly reference.
Using statements don’t help. A using directive would, but you need the alias for this to work. So, dumb it may be, but it is C# dumb.