BAQDataView broken after upgrade to 2021.2

So I rewatched the video here: BAQ Dataview Example Video - #35 by Banderson and updated my customization.
(Direct link to YouTube video by Carson: Epicor BAQ DataView - YouTube )
I have it working now. I think I had some confusion about where to put the BAQ name. In the code below, my BAQ is named “PurchAdvisorPriceList”

// **************************************************
// Custom code for PurchaseAdvisorEntryForm
// Created: 5/6/2022 3:36:10 PM
// **************************************************

extern alias Erp_Contracts_BO_PartOnHandWhse;
extern alias Erp_Contracts_BO_Part;

using System;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Windows.Forms;
using Erp.Adapters;
using Erp.UI;
using Ice.Lib;
using Ice.Adapters;
using Ice.Lib.Customization;
using Ice.Lib.ExtendedProps;
using Ice.Lib.Framework;
using Ice.Lib.Searches;
using Ice.UI.FormFunctions;
using Ice.Lib.Broadcast;

public class Script
{
	// ** Wizard Insert Location - Do Not Remove 'Begin/End Wizard Added Module Level Variables' Comments! **
	// Begin Wizard Added Module Level Variables **

	// End Wizard Added Module Level Variables **

	// Add Custom Module Level Variables Here **
	BAQDataView AdvPriceListDV;

	public void InitializeCustomCode()
	{
		CreatePriceListBAQDV();
		
		// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Variable Initialization' lines **
		// Begin Wizard Added Variable Initialization

		// End Wizard Added Variable Initialization

		// Begin Wizard Added Custom Method Calls

		// End Wizard Added Custom Method Calls
		

	}
	
	public void DestroyCustomCode()
	{
		// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Object Disposal' lines **
		// Begin Wizard Added Object Disposal

		// End Wizard Added Object Disposal

		// Begin Custom Code Disposal

		// End Custom Code Disposal
	}
public void CreatePriceListBAQDV()
	{
		AdvPriceListDV = new BAQDataView("PurchAdvisorPriceList");
		oTrans.Add("PurchAdvisorPriceList",AdvPriceListDV);
		string pub1Binding = "Partlist.PartNum";
		IPublisher pub1 = oTrans.GetPublisher(pub1Binding);
		if(pub1==null)
		{
			string pubName = Guid.NewGuid().ToString();
			oTrans.PublishColumnChange(pub1Binding, pubName);
			pub1 = oTrans.GetPublisher(pub1Binding);
		}
		
		if(pub1 !=null)
			AdvPriceListDV.SubscribeToPublisher(pub1.PublishName, "VendPart_PartNum");
	}
}
1 Like