Populate VendPart Detail with Part Data after Supplier is Entered

I have been working on some customizations with the Supplier Price List screen, and was wondering if it might be possible to populate the VendPart detail for all parts after the Supplier has been entered. Here’s what I came up with for my best attempt, but it is not loading any data:

private void btnGetBPOPart_Click(object sender, EventArgs args)
{
	EpiDataView edvvendView = (EpiDataView)oTrans.EpiDataViews["vendView"];
	int iVendorNum = Convert.ToInt32(edvvendView.dataView[edvvendView.Row]["VendorNum"]);
	string sVN = Convert.ToString(edvvendView.dataView[edvvendView.Row]["VendorNum"]);
	string bpo = txtBlanketPoNum.Value.ToString();

	VendPartAdapter adpVP = new VendPartAdapter(this.oTrans);
	adpVP.BOConnect();
	SearchOptions vpOpts = new SearchOptions(SearchMode.AutoSearch);
	vpOpts.DataSetMode = DataSetMode.RowsDataSet;
	vpOpts.SelectMode = SelectMode.MultiSelect;
	vpOpts.PreLoadSearchFilter = "VendorNum = '" + sVN + "'";
	adpVP.InvokeSearch(vpOpts);
	if(adpVP.VendPartData.VendPart.Rows.Count > 0)
	{
		foreach(DataRow row in adpVP.VendPartData.VendPart.Rows)
		{
			string cPartNum = adpVP.VendPartData.VendPart.Rows[0]["PartNum"].ToString();
			Erp.BO.VendPartDataSet vpds = adpVP.GetVendPartByVendNumPart(iVendorNum, cPartNum);
		}
	}
	adpVP.Dispose();
}

If anyone has any insights as to how this might be accomplished, it would be greatly appreciated.

Just checking… you mean you want to auto-populate the part list?
image

Yes, that’s correct. Do you think my method was close? Of course, I’m open to any ideas!

My only thoughts…
I might try and do this with BPM Widgets instead of custom code.
While widgets can definitely be a little more tedious, in theory are more compatible with upgrades.

And I might insert a few message-boxes too… verify key values are populated and if things are flowing as expected?

Just in case anyone needs to accomplish something similar, I would like to post the code I used to complete this task. First, I created a button with the following screen customization code:

	private void btnGetBPOPart_Click(object sender, EventArgs args)
	{
		string vno = GetVendorNum();
		string bpo = GetBPO();
		if(vno == "") throw new Exception("No Vendor ID specified.");
		if(bpo == "") throw new Exception("No Blanket PO specified.");
		int iVendorNum = Convert.ToInt32(vno);
		FetchAllVendorPartsForBPO(vno, bpo);
	}

Note that my GetVendorNum and GetBPO methods were just responsible for retrieving the two values I needed to pass along. The FetchAllVendorPartsForBPO method is shown here:

	private void FetchAllVendorPartsForBPO(string vno, string bpo)
	{
		SearchOptions vpOpts = new SearchOptions(SearchMode.AutoSearch);
		vpOpts.DataSetMode = DataSetMode.RowsDataSet;
		vpOpts.SelectMode = SelectMode.MultiSelect;
		vpOpts.PreLoadSearchFilter = "VendorNum = '" + vno + "' AND BlanketPO_c = '" + bpo + "'";
		oTrans.InvokeSearch(vpOpts);
	}

I must confess, I was surprised that this could be accomplished with so little code, but it really worked out well and properly populated all fields for all parts retrieved by the search.

Cheers,
Tony G.

Hi, I know this has been late, but may I know is there anyway to replicate the same thing for pricelstparts similar to yours. However, I am not sure what business objects we need to call to get existing pricelstparts so that it populates on the partnum on pricelstparts. I also wanted to know is there additional bo method or anything else you did for the form to pop up?