I have tried this multiple ways and if I can't add these columns then I am probably going to have to make all the Employees have separate Windows and Vantage logons to allow me to use the Entry person that already exists on the grid - the only problem is it still doesn't show the User ID correctly on Backflush records. I'm sure I am pretty close the resolution but just can't see what I'm missing on here. Thanks in advance.
I have tried using a BPM to update the EmpID field that already exists in the PartTran table. Even though it exists on the table, it doesn't exist on the grid and I am getting this error:
System.ArgumentException: EmpID is neither a DataColumn nor a DataRelation for table PartTranHist.
I have also tried using an adapter to link to JobHead I have the following problem:
************** Exception Text **************
Epicor.Mfg.Common.BusinessObjectException: Record not found.
at Epicor.Mfg.Proxy.JobEntryImpl.GetByID(String jobNum)
at Epicor.Mfg.UI.Adapters.JobEntryAdapter.GetByID(String jobNum)
at Script.getEmployeeID(String job)
at Script.AddEmployeeInfo()
at Script.edvPartTranHist_EpiViewNotification(EpiDataView view, EpiNotifyArgs args)
at Epicor.Mfg.UI.FrameWork.EpiViewNotification.Invoke(EpiDataView view, EpiNotifyArgs args)
at Epicor.Mfg.UI.FrameWork.EpiDataView.Notify(EpiNotifyArgs args)
at Epicor.Mfg.UI.App.PartTranHistTracker.Transaction.GetPartTranHistRows()
'//**************************************************
'// Custom VB.NET code for PartTranHistForm
'// Created: 08/06/2016 13:32:32
'//**************************************************
Imports System
Imports System.Data
Imports System.Diagnostics
Imports System.Windows.Forms
Imports System.ComponentModel
Imports Microsoft.VisualBasic
Imports Epicor.Mfg.UI
Imports Epicor.Mfg.UI.FrameWork
Imports Epicor.Mfg.UI.ExtendedProps
Imports Epicor.Mfg.UI.FormFunctions
Imports Epicor.Mfg.UI.Customization
Imports Epicor.Mfg.UI.Adapters
Imports Epicor.Mfg.UI.Searches
Imports Epicor.Mfg.BO
Module Script
'// ** Wizard Insert Location - Do Not Remove 'Begin/End Wizard Added Module Level Variables' Comments! **
'// Begin Wizard Added Module Level Variables **
Private WithEvents edvPartTranHist As EpiDataView
'// End Wizard Added Module Level Variables **
'// Add Custom Module Level Variables Here **
Sub InitializeCustomCode()
'// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Variable Intialization' lines **
'// Begin Wizard Added Variable Intialization
edvPartTranHist = cType(oTrans.EpiDataViews("PartTranHist"), EpiDataView)
'// End Wizard Added Variable Intialization
'// Begin Custom Method Calls
If Not (edvPartTranHist.dataView.Table.Columns.Contains("EmployeeID")) Then
edvPartTranHist.dataView.Table.Columns.Add(new DataColumn("EmployeeID"))
End If
If Not (edvPartTranHist.dataView.Table.Columns.Contains("EmployeeName")) Then
edvPartTranHist.dataView.Table.Columns.Add(new DataColumn("EmployeeName"))
End If
'// End Custom Method Calls
End Sub
Sub DestroyCustomCode()
'// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Object Disposal' lines **
'// Begin Wizard Added Object Disposal
edvPartTranHist = Nothing
'// End Wizard Added Object Disposal
'// Begin Custom Code Disposal
'// End Custom Code Disposal
End Sub
Private Sub edvPartTranHist_EpiViewNotification(view As EpiDataView, args As EpiNotifyArgs) Handles edvPartTranHist.EpiViewNotification
'// ** Argument Properties and Uses **
'// view.dataView(args.Row)("[FieldName]")
'// args.Row, args.Column, args.Sender, args.NotifyType
'// NotifyType.Initialize, NotifyType.AddRow, NotifyType.DeleteRow, NotifyType.InitLastView, NotifyType.InitAndResetTreeNodes
'MsgBox("edvPartTranHist_EpiViewNotification-1 Fired")
AddEmployeeInfo()
If (args.NotifyType = EpiTransaction.NotifyType.AddRow) Then
If (args.Row > -1) Then
End If
End If
End Sub
Private Sub AddEmployeeInfo()
'MsgBox("AddEmployeeInfo Fired")
For Each dr As DataRow in edvPartTranHist.dataView.Table.Rows
If Not IsDBNull(dr("JobNum")) Then
dr("EmployeeID") = getEmployeeID(dr("JobNum"))
End If
Next
End Sub
Private Function getEmployeeID(ByVal job As String) As String
Dim EmployeeID As String
Dim myGrid As EpiUltraGrid = cType(csm.GetNativeControlReference("f83d6262-a7d9-4fb5-a7d0-54644a9bb66b"), EpiUltraGrid)
Dim adpJobEntry As JobEntryAdapter = New JobEntryAdapter(PartTranHistForm)
adpJobEntry.BOConnect()
Dim edvPartTranHist As EpiDataView = CType(oTrans.EpiDataViews("PartTranHist"), EpiDataView)
Dim result As Boolean = adpJobEntry.GetByID(job)
Dim dsJobInfo As DataSet = adpJobEntry.JobEntryData
MsgBox("getEmployeeID Fired")
Dim recordSelected As Boolean
Dim showSearch As Boolean = False
Dim whereClause As String = "'JobNum = '" + job + "'"
If recordSelected = True And adpJobEntry.JobEntryData.JobHead(0)("JobNum") <> "" Then
EmployeeID = adpJobEntry.JobEntryData.JobHead(0)("ShortChar04")
Else
EmployeeID = ""
End If
Return EmployeeID
End Function
End Module