Can't set Selected Serial Numbers in BPM


I have been working on creating a BPM to automate some of the RMA process and am currently working with the creation of a new receipt process where a serial number must be selected. I have got the process working up until that last part where I get an error stating that I haven’t selected enough serial numbers. (Usually 0 of 1) I have performed a trace and compared the functions but don’t see anything obviously missing. I have also got this complete process working perfectly in a customization, but wanted to move it to a BPM.
The process is in an epicor function that is used in an update BPM on a UD table.

Any help towards solving this would be greatly appreciated!


It would be best to see the code. Otherwise, we can’t tell you what is wrong.

I have done this before and the code to manipulate the selection lists was nothing short of gymnastics.

Here is the working code that I am trying to translate into a BPM

private void getNewReceipt()
		EpiDataView edvCase = (EpiDataView)(oTrans.EpiDataViews["LateCase"]);

		RMAProcAdapter RMAAdapter  = new RMAProcAdapter(oTrans);

		SerialNoAdapter SNAdapter  = new SerialNoAdapter(oTrans);

		bool userInput = false;
		int RMANum = (int)edvCase.dataView[edvCase.Row]["HDCase_RMANum"];
		int RMALine = (int)edvCase.dataView[edvCase.Row]["RMARcpt_RMALine"];
		string SerialNum = edvCase.dataView[edvCase.Row]["HDCase_SerialNumber"].ToString();
		string PartNum = edvCase.dataView[edvCase.Row]["HDCase_PartNum"].ToString();
		string empty = "";
		int test = 0;

			SNAdapter.GetByID(PartNum, SerialNum);
			RMAAdapter.GetNewRMARcpt(RMANum, RMALine);
			RMAAdapter.RMAProcData.RMARcpt[0].ReceivedQty = 1; //decReceivedQty;
			RMAAdapter.RMAProcData.RMARcpt[0].WareHouseCode = "Service";


			RMAAdapter.RMAProcData.RMARcpt[0].BinNum = "Depot";
			RMAAdapter.RMAProcData.RMARcpt[0].RequestMove = false;
			RMAAdapter.RMAProcData.RMARcpt[0].SerialNumber = SerialNum;

			DataRow newRow = RMAAdapter.RMAProcData.SelectedSerialNumbers.NewSelectedSerialNumbersRow( );

			newRow[ "SerialNumber" ] = SerialNum;
			newRow[ "Company" ] = "EmbedTek";
			newRow[ "PartNum" ] = PartNum;
			newRow[ "NotSavedToDB" ] = true;
			RMAAdapter.RMAProcData.SelectedSerialNumbers.Rows.Add( newRow );
		RMAAdapter.PreUpdate(out userInput);

My solution required reflection. I cant outright share the code as it is a customer solution, but here is the method I used to commit my serial changes.

void CommitSerials(ConcurrentQueue<SelectedSerialNumbersDataSet> list, ProgressBar pb )

		var sn = (SelectedSerialNumbersDataSet)oTrans.GetFieldValue("dsTempSelectedSN");
		foreach(var s in list)
			sn.SelectedSerialNumbers.Merge(s.SelectedSerialNumbers, true, MissingSchemaAction.Ignore);

I appreciate a look at the code but I needed this to work in an epicor function because of the issues with the RMA adapters not wanting to play nice. I was not able to get this done in a widget function so I moved everything to a custom code function and added it directly to the table. Works great now for automating the RMA Receipt creation and disposition process.