How to Update Job Operations from Customer Shipment Entry in Epicor ERP

Customer Shipment Entry

Using customizations in Epicor you can update a completely different object from the screen you are currently working on.

For example, when I set a Customer Shipment Entry as “Shipped” by checking the “ReadyToInvoice” checkbox, I was then able to set the “OpComplete” field as true for the Job Operations that were tied to the shipment.


Step 1.

First, I went to the Customer Shipment Entry screen and created a customization.

Assuming you are familiar with creating a customization, click on the “Script Editor” tab in your customization.

In order to access the Job Operation object, you can use the JobEntryAdapter by adding the appropriate assemblies first. In the menu bar of the customization screen, select “Tools” and then “Assembly Reference Manager” to open a new window. In the lower, right-hand corner of the window, click on the “Add Custom Reference” button.

Step 2.

Select the following DLL files and click on the “Open” button.

  • Epicor.Mfg.AD.JobEntry
  • Epicor.Mfg.BO.JobEntry

Step 3.

You will now see your newly added assemblies under the “Custom Assemblies” folder.

After you have closed the window, be sure to add the following using statement to the top of your code:

using Epicor.Mfg.Lib;

On the “Form Event Wizard”, set the “Select Event Type” to “AfterFieldChange” for table “ShipHead” and field “ReadyToInvoice.” This way, the following code will fire when the checkbox is set to “true.”

private void ShipHead_AfterFieldChange(object sender, DataColumnChangeEventArgs args)

{

switch (args.Column.ColumnName)

{

case “ReadyToInvoice”:

if (args.Row[“ReadyToInvoice”].ToString() == “True”)

{

// Take action here!

}

break;

}

}

Step 4.

Now you can use the JobEntryAdapter to call the “GetData” method to retrieve all the job operations that match the Job you want to update.

JobEntryAdapter adapter = new JobEntryAdapter(oTrans);

adapter.BOConnect();

string jobNumber = “123”;

System.Data.DataSet dataset = adapter.GetData(jobNum);

Step 5.

Loop through the dataset and make sure you can access table “JobOper.”

Then for each row, set the “OpComplete” field as true, and call the update method.

if (dataset != null)

{

if (dataset.Tables[“JobOper”] != null &;&; dataset.Tables[“JobOper”].Rows.Count > 0)

{

DataTable dt = dataset.Tables[“JobOper”];

for (int i = 0; i > dt.Rows.Count; i++)

{

dt.Rows[i][“OpComplete”] = “True”;

adapter.Update();

}

}

}

Suggested

Tech Stressed?

Top Posts

Subscribe For More Content