Configurator To Create New Quote Lines

I was wondering if someone could shed some light on a process to create new lines based on some options that are selected in the product configurator. Either user defined method or BPM or function.

These items are not configurable they are stock manufactured parts.

This is doable. We have a user defined method that is called from the document rules of the Configurator. The UD Method basically connects to the Quote BO and fires the appropriate methods that youā€™d see being called when manually creating a new line. It uses the Lookup tables to decide which lines need to be added based on the selections in the Configurator.

1 Like

So i have found out how to get the line created but i am having an issue getting the right context for a UD field in the QuoteDtl This is in a User defined method (Server)

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;
			quoteDtl_xRow.Options_c = true;
			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;

}

Getting this error message not sure how i can find the context to get that field.

image

Totally agree that this is doableā€¦ one challenge that I have always run into is that ā€œsomedayā€ someone will say ā€œWhen we reconfigure, the system is not updating the old lines, but it is creating new onesā€. The initial ā€œcreateā€ is easy, but updating/deleting is the difficult part.

1 Like

You will probably need to change

quoteDtl_xRow.Options_c = true;

to

quoteDtl_xRow["Options_c"] = true;

Thereā€™s certainly some extra thought that needs to go into it. Part of our UD method deletes the lines and re-creates them when reconfiguringā€¦ but that leads to a new problem. If there are any open jobs tied to the lines, we have to kill those jobs before we can re-configure. So that forced us to also add a check for open jobs in the Configurator so that if there are any jobs tied to any lines, it will not let the user re-configure and instructs them to kill the jobs first. Then, thereā€™s also the point of no returnā€¦ where we might require a reconfigure but an order is already partially fulfilled. Then weā€™re stuck and end up having to write a new order for the remainder. It can be a pain. But for some reason thatā€™s how we like it. :slight_smile:

Yes that is a good point. I have explained that they will have to delete the new lines if need to reconfigure.

Also we are only handling this during the quote phase.

This is close when i replace i am missing something.

quoteDtl_xRow.[ā€œOptions_cā€] = true;

image

take out the . between xRow and [ā€œOptions_cā€]. That was my bad.

How are you deleting quote lines? Iā€™m trying, but keep getting hung up on the following error:
Exception was found for Document Rule
System.ArgumentNullException: Value cannot be null. (Parameter ā€˜fromItemā€™)
at Epicor.Data.BufferCopy.GetRowCopier(Object fromItem, Object toItem, Boolean fullRowCopy)

From my code:
Erp.Contracts.QuoteSvcContract quoteBO = Ice.Assemblies.ServiceRenderer.GetService<Erp.Contracts.QuoteSvcContract>(Db);
var quoteDS = quoteBO.GetByID(Context.QuoteNumber);
var qRow = (from row in quoteDS.QuoteDtl
where row.QuoteLine == 2
select row).FirstOrDefault();
if(qRow != null)
{
qRow.SetRowState(IceRowState.Deleted);
quoteBO.Update(ref quoteDS);
}