Copy UD Field from Project Entry to SO Entry Using Customization Dropdown Change Event

I have a UD field on Project Entry: Urgency_c (EpiTextBox)

I have a UD field on SO Entry: Urgency_c (EpiTextBox)

I have a UD field on SO Entry: ShortChar08 (EpiUltraCombo)

I have a customization event handler on SO Entry for ShortChar08: ProjectID_EpiComboChanged

When the EpiCombo (ProjectID) changes, I want it to take the ProjectID value and search for that project and return the value of the UD field Urgency_c.

The problem I have is that if I use “GetList” or “ListLookup” - query performance is fast, but they don’t provide access to UD fields.

If I use “GetRows”, which provides access to UD fields, the Epicor UI locks up as it queries the ENTIRE Project dataset including all previous SOs, Jobs, and any other data attached to the Project, which for large projects is a non-starter.

How can I quickly import a UD field from one module to the other using a customization?

I’m familiar with doing this with a BPM triggered by Update, on save, but I’m looking to dynamically populate the value when the user selects the Project ID instead of hitting save for a less confusing user experience.

Can you use the Extended Properties Like/linked options to sync the SO header field to the Proj Head Urgency field?

It’s been a long while since I messed with that stuff, but I vaguely recall that being the go-to place for cross referencing field values like that.

After many attempts and different strategies, I was informed of Dynamic Queries and was able to successfully leverage that approach:

private void ProjectID_EpiComboChanged(object sender, System.EventArgs args)
{
	try {
		Ice.Lib.Framework.EpiUltraCombo ucmbProjectID = ((Ice.Lib.Framework.EpiUltraCombo)csm.GetNativeControlReference("e7d827d7-f6ba-4a3c-8b84-061a516bf745"));
		string projectIdValue = Convert.ToString(ucmbProjectID.Value);
		if (projectIdValue == "") return;

		DynamicQueryAdapter dqa = new DynamicQueryAdapter(oTrans);
		dqa.BOConnect();
		QueryExecutionDataSet qeds = dqa.GetQueryExecutionParametersByID("GetProjectUrgency");
		qeds.ExecutionParameter.Clear();
		qeds.ExecutionParameter.AddExecutionParameterRow("ProjectID", projectIdValue, "nvarchar", false, Guid.NewGuid(), "A");
		dqa.ExecuteByID("GetProjectUrgency", qeds);
		if(dqa.QueryResults.Tables["Results"].Rows.Count > 0)
		{
			string urgencyValue = (string)dqa.QueryResults.Tables[0].Rows[0][0];  // Urgency_c
			string contractValue = (string)dqa.QueryResults.Tables[0].Rows[0][1]; // ConReference
			if (contractValue.ToLower().Trim() == "no contract" ) {
				contractValue = "";
			}
			EpiDataView edvOrderHed = (EpiDataView)oTrans.EpiDataViews["OrderHed"];
			edvOrderHed.dataView[edvOrderHed.Row]["Urgency_c"] = urgencyValue;
			edvOrderHed.dataView[edvOrderHed.Row]["ShortChar05"] = contractValue;
		}
	} catch (System.Exception ex) {
		ExceptionBox.Show(ex);
	}
}

And thanks to Rick Bird of Aligned Solutions.

1 Like