Configurator Theory

Can you call an Epicor Method from the Configurator User Defined Methods?

I pulled up the tracing and wanted to play with copying a part master record in the configurator rules but get errors on compile so I was wondering if anyone else in the community had success with calling Epicor Methods via UD Methods.

I don’t think they have added an official way to do that yet. Once your configurators reach a certain level of complexity its easier to make an external app and interact with Epicor with the REST API in my experience.

As a hack, you could have the User Method update some unused UD table, and then have a BPM fire on the change of the UD table. In that BPM, call the Epicor method you want.

You could even use the columns of the UD table to hold parameters to “pass” to the BPM.

Hey Max! It’s been a while.

Here’s something I’ve done to create quote lines from a configurator using a BO method.

There’s a UD method named “CreateLines” that calls “CreateQuoteLine” to create a new line.

In CreateQuoteLine I added the reference for Erp.Contracts.BO.Quote.dll:

Here’s the text of UD method CreateQuoteLine:

returnVal = "Start create";

DateTime shipDate = new DateTime();

if (quoteNum > 0 && partNum.Length > 0)
	Erp.Contracts.QuoteSvcContract quote;
	quote = Ice.Assemblies.ServiceRenderer.GetService<Erp.Contracts.QuoteSvcContract>(Db);
	Erp.Tablesets.QuoteTableset quoteTableset;

	quoteTableset = quote.GetByID(quoteNum);

	quote.GetNewQuoteDtl(ref quoteTableset, quoteNum);

	var quoteDtl_xRow = (from quoteDtl_Row in quoteTableset.QuoteDtl
			select quoteDtl_Row).LastOrDefault();
	bool lSubstitutePartsExist = false;
	string uomCode = "";

	int year = 0;        

	if(quoteDtl_xRow != null)
			quoteDtl_xRow.PartNum = partNum;

			if(reqQty > 0)
						   quoteDtl_xRow.SellingExpectedQty = reqQty;
						   quoteDtl_xRow.OrderQty = reqQty;
			if(shipDate != null && shipDate >= DateTime.Today)
						   quoteDtl_xRow.ReqShipDate = shipDate;

			returnVal = "Quote Num: " + Convert.ToString(quoteDtl_xRow.QuoteNum);
			returnVal += " - part Num: " + quoteDtl_xRow.PartNum;

	quote.ChangePartNum(ref quoteTableset, lSubstitutePartsExist, uomCode);

	returnVal += " - uomCode " + uomCode;
	returnVal += " - Part Desc: " + quoteDtl_xRow.LineDesc;

	quote.Update(ref quoteTableset);

	returnVal += " - Quote Line: " + Convert.ToString(quoteDtl_xRow.QuoteLine);

	quote = null;
	quoteTableset = null;


And the UD method CreateLines that calls it:

string returnVal = "";
string partNum = SummaryPartNum;
decimal reqQty = SummaryQty;

if (Context.Entity == "OrderDtl")

	int orderNum = Context.OrderNumber;

	CreateSOLine(ref returnVal, ref orderNum, ref partNum, ref reqQty);
else if (Context.Entity == "QuoteDtl")
	int quoteNum = 0;
	quoteNum = Context.QuoteNumber;

	**CreateQuoteLine(ref returnVal, ref quoteNum, ref partNum, ref reqQty);**

Note that there is a similar UD method CreateSOLine for operating within an order.

Caveat: This was running in 10.1.500 Test environment, I think. In order to use the import feature to load this into another environment I had to go into the XML and delete the assembly reference. It likely had to do with where the assemblies were stored on the new environment.

Something like this:

Delete this from the exported XML
    <Alias />
    <Alias />

After the import I just added the references again.

See if that helps.

Your mileage may vary.