Custom BAQ Action To Add UD06 Record

I want to use a UBAQ to submit records to UD06. The UBAQ is named “WinQuotes”. The Custom action is called “WonQuote”. From The QuoteEntry form, I want to execute the UBAQ to submit a record if the user clicks the WinQuote button I added to the line. The button should pull the Quote number, and line number, then submit a record to UD06 with those as Key1 and 2, along with a true checkbox01 value.

Normally, when I run a custom action from a UBAQ, I am sending the results back to a grid on the form. In this case, the BAQ results stay hidden, and the BAQ is only used to submit the record to UD06.

This is what I would use to submit a custom action when the BAQ is linked to a grid dataview.

	private void BAQRunCustomAction(EpiDataView iEdv, string iActionID)
	{
	    BAQDataView BAQView = (BAQDataView)iEdv;
	    Assembly assembly = Assembly.LoadFrom("Ice.Lib.EpiClientLib.dll");
	    Type t = assembly.GetType("Ice.Lib.Framework.BAQUpdater");
	    BindingFlags bf = BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy;
	    MethodInfo mi = t.GetMethod("BAQRunCustomAction", bf);
	    object[] param = new object[] { BAQView, iActionID};
	    mi.Invoke("Ice.Lib.Framework.BAQUpdater", param);
	}

Can I modify this code to accept the BAQ ID instead of an epidataview?

I think that I would pass my data from this form to my BAQ thorugh CallContext, something like this:

	private void btnWinQuoteLine_Click(object sender, System.EventArgs args)
	{
		
		// ** Place Event Handling Code Here **
		EpiDataView edvQuotes = (EpiDataView)(oTrans.EpiDataViews["OrderDtl"]);
		object myLine = edvQuotes.dataView[edvQuotes.Row]["QuoteLine"];
		
		EpiDataView edvCallContextBpmData = ((EpiDataView)(this.oTrans.EpiDataViews["CallContextBpmData"]));
		System.Data.DataRow edvCallContextBpmDataRow = edvCallContextBpmData.CurrentDataRow;	
		
		edvCallContextBpmDataRow["ShortChar01"] = txtMyQuote.Value.ToString();
		edvCallContextBpmDataRow["ShortChar02"] = myLine.ToString();
		// Run custom code in BPM	
		BAQRunCustomAction("WinQuotes", "WonQuote");
	}

Then, inside my custom action, I take a look at the callcontext values and save them into internal variables. I create a new records in UD06 with these callcontext values as the keys.

How can I send callcontext data to my BAQ, and the run my custom BAQ action even though I don’t have a BAQ grid on my form?
Thanks!
Nate

Is there a specific reason for using a UBAQ ? Why not just call GetaNew, set your fields and then Update directly from your form ? Below is a function for adding a rec in UD07 from an E10 customization.

	// adds a new record in UD07
	private void AddNewUD07Record(string pKey1, string pKey2, int pID)
	{
		// get & connect ud07 adapter
		UD07Adapter ud07adpt = new UD07Adapter(this.oTrans);
		ud07adpt.BOConnect();

		// get new ud07 record
		bool recadded = ud07adpt.GetaNewUD07();

		// if new rec added
		if (recadded)
		{
			// set keys
			ud07adpt.UD07Data.UD07.Rows[0]["Key1"] = pKey1;
			ud07adpt.UD07Data.UD07.Rows[0]["Key2"] = pKey2;
			ud07adpt.UD07Data.UD07.Rows[0]["Key3"] = pID.ToString();

			// save changes
			ud07adpt.Update();
		}

		// clean adapter
		ud07adpt.Dispose();
	}

For call context, i use something like below:

// set call context cbox3
EpiDataView ccv = (EpiDataView)oTrans.EpiDataViews["CallContextBPMData"];
DataRow ccrw = ccv.CurrentDataRow;
ccrw.BeginEdit();
ccrw["CheckBox03"] = false;
ccrw.EndEdit();
//oTrans.Update();
//oTrans.Refresh();
2 Likes

I like this approach! What is pID for? I have the values for keys 1 and 2. Just not sure about that last one.

It’s like an auto-number for the records (like a record count). But don’t worry about it, you can use string Key3 instead.

LE: you don’t necessarily need to use all 3 keys. When you call getaNew it sets the 5 keys to empty so you don’t need to worry about that. Use only how many you need.

1 Like

This works great! Thank you!