Update all OrderRel Plant when Specific field change on orderhed

Hi Guys,

I’m new to Epicor and still trying to get hold of the beast. I have a problem in customization. I’m trying to update the plant and the warehouse of the releases on a certain condition in orderhed. The issue I’m facing is that the fields are changing in the UI, but I cannot save afterward since it’s telling me that the row has been modified by another user. Here’s the code :

1 Like

I had to do something similar and ended up with a Combo and button on the Summary sheet.
The user selects the Site from the Cumbo, and then clicks the button. This then goes through and updates the Ship From info on every release.

Here’s the Button code.
(bcmbSiteWhse is the combo - it just holds the id and name of the site/plant)

private void btnFromChal_Click(object sender, System.EventArgs args)
	{
		// ** Place Event Handling Code Here **
		if((string)bcmbSiteWhse.Text == ""){
			return;
			}
		string newSite= ((string)bcmbSiteWhse.Value).Split(new Char [] {'~'})[0];
		string newWhse= ((string)bcmbSiteWhse.Value).Split(new Char [] {'~'})[1];
		//MessageBox.Show("Plant:" + newSite +"\nWhse: "+newWhse);
		

		DialogResult result1 = MessageBox.Show("Are you sure you want to set all open releases to ship from:\n" + (string)bcmbSiteWhse.Text, "Mass Change Ship From", MessageBoxButtons.YesNo);
		if (result1 == DialogResult.Yes){
		
			EpiDataView orderRel = (EpiDataView)(oTrans.EpiDataViews["OrderRel"]); // We will need the order release view
			//string currSite = orderRel.CurrentDataRow["Plant"].ToString();
			//currSite = "MfgSys";
			//string currWhse = orderRel.CurrentDataRow["WarehouseCode"].ToString();
			//currWhse = "mfg";
			int releaseCounter = 0;
			        
	        foreach (DataRow relLine in orderRel.dataView.Table.Rows){
	            if ((bool)relLine["OpenRelease"] == true){ // && (string)relLine["Plant"] != currSite && (string)relLine["WarehouseCode"] != currWhse){
	                relLine.BeginEdit();
	                relLine["Plant"] = newSite;
	                relLine["WarehouseCode"] = newWhse;
	                relLine.EndEdit();
					releaseCounter++;               
	            	}
	        	}
			oTrans.NotifyAll();  
			MessageBox.Show(releaseCounter.ToString() + " Releases updated.\n\n Don't forget to save!");
			}
	}

You’ll be most interested in the stuff after
if (result1 == DialogResult.Yes){...

Thanks for your answer. I think I found my problem but not sure how to fix it. The problem is that the trigger that is modifying the Order Releases is on customer change. I then modify the releases but when I finally save, Epicor tries to update the release as well to change the customer on the release. Since the row is already modified, it throws an error saying that the row has already been modified. I have no clue how to fix that though.

Thanks anyway !

I’ve seen people have issues of line details changing when the ShipTo changes. What they do is save all the data to a UD table before the ShipTo Changes, then restore the details and releases afterwards.

@alexbg89 if you’re automating anything on OrderRel you better read this… I just learned the hard way.

By the way are you also in QC?