Foreign Key View from Payroll Employee to EmpBasic

I am having difficulty creating a Foreign Key View (FKV) on the Payroll Maintenance menu to EmpBasic. Specifically, I need a UD field attached to the EmpBasic table. Using methods I know, I either get no data or a link to the PREmpMas table.

First, there is a EmpBasic view already present when I open the data tools message box. However, whenever I link a text box to that NV, it returns empty with every column I’ve tried. Originally, I tried to create a FKV to that NV to be able to return the UD fields. However, once I discovered it was blank, it was obviously blank, as well.

I also have tried to create a new FKV from PREmployee (which does return data) to EmpBasic using:

Parent View Name: PREmployee
View Type: Foreign Key View

Column Name: EmpID
Like Column Value: EmpBasic.EmpID
Adapter Name: EmpBasicAdapter
Get By Type: StringGetByID

This returns the PREmpMas fields, instead of the EmpBasic fields. I also set it up the same with:

Like Column Value: PREmployee.EmpID
Adapter Name: PREmployeeAdapter

And got the same results, PREmpMas fields. I also tried IntegerGetByID.

Any thoughts on this? Is this a permissions issue between EmpBasic and PREmpMas? I know I have Payroll Manager permissions to access these employees I’m checking.

If there isn’t a way to establish an FKV, what is the best workaround on this? I want a Text box to return a UD field from EmpBasic.

I have turned this issue into Epicor support and they have created a Problem number of PRB0240279 for the issue.

I’m looking into a workaround in the meantime.

The PRB0240279 is still considered a work in progress from Epicor support. Last update was 11/1/2021.

So, our workaround for this is to create a matching UD field in both PREmpMas and EmpBasic. Then, we are creating a Method Directive BPM on each Update for the field that writes the new value to the other table’s matching field. This way, users can update one and both will get the same value.

We have created matching BPMs on EmpBasic.Update and PREmpMas.Update Business Objects. Each sets the matching field (Position_c) in the other table.

First, I am setting a Pre-Processing that uses the widgets to check if this field has been changed in that temporary table (ttPREmpMas) from any to another, then TRUE enables the post process directive.

Next, there is a Post Processing that checks if it has been enabled from that Pre-Processing BPM and TRUE runs this custom code:

foreach (var PR in ttPREmpMas)
{
   var pt = (from EmpRow in Db.EmpBasic
                  where string.Compare(PR.Company, EmpRow.Company, true) == 0 && 
                             string.Compare(PR.EmpID, EmpRow.EmpID, true) == 0
                  select EmpRow).FirstOrDefault();

   if (pt != null)
   {
      pt.SetUDField("Position_c",PR["Position_c"]);
      
   }
}
Db.Validate();

This solves our issue as a workaround. We have fields in both tables because we cannot set the Foreign Key View between PREmpMas to EmpBasic. This method does keep them synchronized.