Customization beginner question

Hi all, I again find myself confused by an overabundance of information about a beginner’s topic.

What is the correct practice when you want to add a field to an epitextbox which is not there in the available EpiBindings? I’ve done this sort of thing with UD fields, but that was for more straightforward. Is this when you create a data view in the script editor? I’m truly sorry for this completely basic question but I have not been able to sus this out on my own.

If the specifics will help, at the moment I’m trying to add the Ship Via Code from the PO to AP Invoice Entry.

Do you have access the EpicWeb? There’s a classic customization guide on there that for some reason I only found a year into my Epicor journey.

Also if I understand your question, you might be looking for the csm methods:

Control ctrl = csm.GetNativeControlReference(“5483cdef-3049-4705-b597-28ae93b
c7fdf”);

used to get access to native controls. Search this forum for GetNativeControlReference.

If you’re talking about pulling data in from elsewhere, you’re looking for adapters.

If you’re talking about looking up data based on a query it’s DynamicQuery.

If none of those give you threads to tug on, tell us a bit more about what you’re trying to do.

1 Like

Hey Steve, thanks. I think I must be looking for Adapters then. I just want to display the ShipViaCode from the related PO on AP Invoice Entry. That actually helps narrow things down immensely, so thank you again.

1 Like

It’s not a basic question at all. Ask away.

1 Like

Hey Kevin. After Steve’s comment I dug into the customization guide and found a couple of threads that suggested maybe I could do this with a Foreign Key View. Here’s what I tried:


script

This does not produce any errors, but does not seem to work. I have not had a chance to test this with a real invoice, but it does not seem to display the ShipVia if I create a test invoice and bring in a PO.

1 Like

To be honest, I’ve never gotten it to work. But my boss, who is not a coder by any means, set
it up with ease. I’d love for someone to show me how and make it make sense.

Same, I tend to just pull in data from places and assign it to variables - even lists if necessary - and then pull it back together.

1 Like

Maybe someone will help a brutha out…

Help Me Monday GIF by Foo Fighters

1 Like

So who is this guy/gal

harry potter GIF

1 Like

You make that sound so simple haha. I must be thinking about this wrong. Should I be getting the ShipViaCode via a BPM and then putting into something accessible from the form? I’m sorry I’m dense.

To be honest, I’m not sure if either of us has really parsed your question yet.

1 Like

Basically once you know the info you need and the basis, you decide on an adapter or a BAQ (also using an adapter, but dynamic query, because it’s faster). You parse the results from your adapter into variables and then set up the logic to make sure you have it right. Then, you assign it to the value of your control, either directly if it’s a custom control or using the csm methods if it’s a native control. It’s not easy or simple but it is logical.

By “basis” I just mean the criteria. For example, something that could be a “where” clause in a query.

Don’t say that dude. 99.9% of intelligence is actually persistence.

1 Like

So you are just wanting to display this field on the screen?

Yep, On Header > Detail, that was the request.

My pilot is running like a tortoise.

2 Likes

Got it. Let me see how to explain this.

Wizard → Reference Adapter/BL Assemblies
Launch Wizard → Get Adapters
Choose PO Adapter
Close

Add this code and a textbox called txtShipViaCode.

	private EpiBaseAdapter oTrans_invAdapter;

	public void InitializeCustomCode()
	{
		// ** 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

		this.oTrans_invAdapter = ((EpiBaseAdapter)(this.csm.TransAdaptersHT["oTrans_invAdapter"]));
		this.oTrans_invAdapter.AfterAdapterMethod += new AfterAdapterMethod(this.oTrans_invAdapter_AfterAdapterMethod);

	}

	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

		this.oTrans_invAdapter.AfterAdapterMethod -= new AfterAdapterMethod(this.oTrans_invAdapter_AfterAdapterMethod);
		this.oTrans_invAdapter = null;

	}


	private void oTrans_invAdapter_AfterAdapterMethod(object sender, AfterAdapterMethodArgs args)
	{
		// ** Argument Properties and Uses **
		// ** args.MethodName **
		// ** Add Event Handler Code **

		// ** Use MessageBox to find adapter method name
		// EpiMessageBox.Show(args.MethodName)

		switch (args.MethodName)
		{
			case "ChangeRefPONum":
				FillSearchFromPOAdapter();
				break;
		}
	}


	private void FillSearchFromPOAdapter()
	{
		EpiDataView edvAPInvHed = ((EpiDataView)(this.oTrans.EpiDataViews["APInvHed"]));
		System.Data.DataRow edvAPInvHedRow = edvAPInvHed.CurrentDataRow;

		bool recSelected;
		string whereClause = "PONum = '" + edvAPInvHedRow["REFPONum"] + "'";

		System.Data.DataSet dsPOAdapter = Ice.UI.FormFunctions.SearchFunctions.listLookup(this.oTrans, "POAdapter", out recSelected, false, whereClause);
		if (recSelected)
		{
			System.Data.DataRow adapterRow = dsPOAdapter.Tables[0].Rows[0];

			//MessageBox.Show(adapterRow["ShipViaCode"].ToString());
			txtShipViaCode.Text = adapterRow["ShipViaCode"].ToString();
		}
	}
2 Likes