Searched but could not find a solid answer for my issue .
Request: Have a UD Table a to store Master / Global Part / UPC values for a multi company setting. When a Part in Individual company is created , check if exists in Global Master , use UPC if does , Create new record in Master / Global company table if not.
Issue: User does not have cross company rights. When writing to Master / Global UD table across companies, error.
Granting user Cross company security rights is not an option. Have looked using REST call Impersonation (Rest call with Global user login ) but messy to incorporate into Function.
Any other solutions / ideas out there ? seems this request may have been had by others .. Sync solution needed , not Asyc.
Thanks for the response.. Could you please elaborate on Db.UDXX ? Is it a Company specific table ? Is it in the Global company ? Where exactly is it located and how does it differ from a company specific UD table ? By fully UD Table : It is Not a child or linked to any standard Epicor table. Sounds promising .. Any Epicor writeups on it I can learn on ?
FYI , currently using UD02 table in the Global company for my Master Part table. Get security error when a user attempts to update the table via a BPM while logged in to the non Global company. User does not have rights in the Global company and cannot be given Cross Company security rights ..
a UD Table isn’t linked to anything we have UD01 and UD02, UD03 etc… those are User Defined Tables that can hold any and all kinds of information.
They are company specific only in such that the Company Field is required to be filled in. However they are Dumb tables that can be written to using the Db Context.
So when you need to write to this table across companies you can do it using the Db Context in a function or a BPM.
And to retrieve the data you can use a cross company BAQ or even a basic UBAQ with a GetList Method that ignores the Company field all together.
When I say Db Context I mean not using the Business Objects (again ONLY do this for UDXX Tables)
Like this
var newRow = new Ice.Tables.UD02();
newRow.Company="GLOBAL";
newRow.Key1="Hello";
Db.UD02.AddObject(newRow);
Db.SaveChanges();
appreciate the explanation. That is the way it is setup.
Further investigation reveals the user is extremely limited by company policy, can’t run BAQ , can’t see data at all …
This am supposing is the reason for errors.. As the function being called from the Data Directive calls BAQ to gather data and update. Works well with a ‘standard’ user. Fails before the Update..
Given this twist , can an access scope grant these rights to the function ?
Access Scope has a tab for Functions.
Any other ideas given the above ?
Function Code C# to Call BAQ:
using (var svc = Ice.Assemblies.ServiceRenderer.GetService<Ice.Contracts.DynamicQuerySvcContract>(context))
{
// Initial check for existing PART / UPC pair
Ice.Tablesets.DynamicQueryTableset dsQuery = svc.GetByID
What if you need to remove a row? Does the context give a way to do this?
And I’m only seeing the following as valid
var newRow = new Ice.Tables.UD02();
newRow.Company="GLOBAL";
newRow.Key1="Hello";
Db.AddObject(newRow);
Db.SaveChanges();
If I try Db.UD02.AddObject(newRow); I get the following:
CS1061 ‘IQueryable’ does not contain a definition for ‘AddObject’ and no accessible extension method ‘AddObject’ accepting a first argument of type ‘IQueryable’ could be found (are you missing a using directive or an assembly reference?)
EDIT: After looking into it a bit longer, it looks like it gets the Entity set from the variable, so Db.AddObject(newRow) should work for UD02 in this case.