Customization to update OrderRel info on button Click

I need to customize the Order Entry screen to allow a mass update of the OrderRel fields Plant and Warehousecode Effectively changing the plant the order will be fulfilled from.

A previous post suggested doing this by walking through the epidataviews of the current order, and making the update there. Then upon saving the order the DB would be updated.

This would be my first time using dataviews, and I’m not sure about all the “houskeeping” that is required to use them properly. So here’s some basic noob questions:

  1. Does the UI always reflect the values in the dataview?
  • I.E. If I change a dataview for OrderHed.ShipToNum to a valid value, would the ShipToNum UI control automatically update, or is a call required to refresh the UI?
  • And what about fields driven from that control? Would the address control be automatically updated to the value related to the new ShipToNum? (like it does when you manually update the ShipToNum field and hit tab)
  1. While experimenting, it looks like the dataviews are “filtered” to the current context. For example, the dataview for the OrderRel only contains the release for the currently selected order line.
  • If so, it looks like I’d have to cycle through a dataview for OrderLine, selecting each line, and then cyling through a dataview for OrderRel, for each release of each line.

So what would be the code to:

  1. Cycle through each release, of each line, of the current order, displaying a messageBox with OrderRel.Plant ?
  2. Cycle through each release, of each line, of the current order, changing OrderRel.Plant to ‘MfgSys’? (later I’ll add checks for things like a valid partplant record, and what not)

Thanks in advance.

Would you like to do this via BPM or via UI Customization

If you do the following you will have a DataView without the OrderLine Filter – you can also bind this to a Grid and itll show up… But you will also be able to loop through OrderRelCustom

// Class Variables
public EpiDataView edvOrderRelCustom;
public EpiDataView edvOrderRelViewCustom;

// Inside Initialize CustomCode
this.edvOrderRelCustom = ((EpiDataView)(this.oTrans.EpiDataViews["OrderRelCustom"]));

// DestroyCustomCode
this.edvOrderRelCustom = null;
this.edvOrderRelViewCustom = null;

* Initialize OrderRelCustom DataView
* @type  Custom Function
public void InitializeOrderRelCustomDataView()
	// Add Adapter Table to List of Views
	this.edvOrderRelViewCustom = new EpiDataView();
	this.edvOrderRelViewCustom.dataView = new DataView(((Erp.Adapters.SalesOrderAdapter)this.oTrans.PrimaryAdapter).SalesOrderData.OrderRel);
	this.edvOrderRelViewCustom.dataView.Sort = "OrderLine ASC, OrderRelNum ASC";
	this.edvOrderRelViewCustom.AddEnabled = false;

	if (this.oTrans.EpiDataViews.ContainsKey("OrderRelCustom") == false)
		this.oTrans.Add("OrderRelCustom", this.edvOrderRelViewCustom);

	// NOTE: When Setting a Parent it breaks Epicor Logic, Lets not set a Parent
	//EpiDataView edvOrderHed = this.oTrans.Factory("OrderHed");
	//this.edvOrderRelViewCustom.SetParentView(edvOrderHed, "OrderNum", "OrderNum");
EpiDataView edvOrderRelCustom = ((EpiDataView)(this.oTrans.EpiDataViews["OrderRelCustom"]));
1 Like

You can also not add a DataView and just loop through the DataRows (which are unfiltered).

1 Like

Thanks so much! Will give it a try this weekend.

But its a nightmare overall… you will have to do this


foreach (OrderRelease)
   // Do Work
   this.oTrans.Update(); // Update PER Release

this.oTrans.Refresh(); // Or you will get RowMod Issues

The same goes for when you do it in a BPM (MasterUpdate) you will have to refresh the DataSet in the POST

PS: Dont forget when the User adds a New Release or Line “After the Fact” it needs to Sync with the Values of the Existing Lines :slight_smile:

1 Like