We are seeing an issue where BuyToOrder on a quote line does not transfer over to the orderrel when flipping the quote to an order. It does for quote FROM and order but not TO an order. We have a ticket open with Epicor at this moment.
We are trying to get around the issue by setting the BuyToOrder manually in a BPM. I am relativly new to Epicor, especially BPMs. This is what I have come up with so far but is it the correct wayt to update the database in Epicor?
foreach( var quoteDtl in (from qd in Db.QuoteDtl
join od in Db.OrderDtl.DefaultIfEmpty() on new {qd.Company, qd.QuoteNum, qd.QuoteLine} equals new {od.Company,od.QuoteNum,od.QuoteLine}
join orel in Db.OrderRel.DefaultIfEmpty() on new {od.Company,od.OrderNum,od.OrderLine} equals new {orel.Company,orel.OrderNum,orel.OrderLine}
join p in Db.Part.DefaultIfEmpty() on new {qd.Company} equals new { p.Company}
where qd.ShortChar01 == p.PartNum
join pp in Db.PartPlant.DefaultIfEmpty() on new {p.Company, p.PartNum} equals new {pp.Company, pp.PartNum}
where (orel.BuyToOrder == false) && (orel.OpenRelease == true) &&( od.OrderNum == orderNum) && pp.BuyToOrder == true
select new {SiteBuyToOrder = pp.BuyToOrder,
OrelBuyToOrder = orel.BuyToOrder,
orel.OrderRelNum,
orel.OrderLine,
orel.OrderNum})) {
foreach(var orderRel in (from OrderRel_Row in Db.OrderRel
where (OrderRel_Row.OrderNum == quoteDtl.OrderNum) && (OrderRel_Row.OrderLine == quoteDtl.OrderLine) && (OrderRel_Row.OrderRelNum == quoteDtl.OrderRelNum)
select OrderRel_Row)) {
orderRel.BuyToOrder = true;
}
}
Are you intending to update every quote / orderrel in the system every time?
Right now you are looping through every ordeal in the system every time.I assume you’d want to do this only once for the current order?
the main question i have is , “is there a way i am supposed to use epicor business objects to make my change to the database within my bmp to do this?”
thanks Jose. Being a noob here, how did you know to call Ice.Assemblies.ServiceRenderer.GetService<Erp.Contracts.SalesOrderSvcContract>(Db))? I did a trace and don’t see any of that code anywhere mentioned.
Trace tells you the BO, to figure out how to call it you need the docs for the Customization User Guide, the ICE Tools Guide and the Programmers Guide (from EpicWeb)
I have the customization user guide and the ice tools guide but where do I find the programmers guide, “business object reference guide”? I can’t find it on epicweb for 10.1.500.
thanks for your help Jose. I am attempting to add what you have given me but i keep getting this error when i enable and save the directive:
Server Side Exception
There is at least one compilation error.
Exception caught in: Epicor.ServiceModel
Error Detail
Description: There is at least one compilation error.
Details:
Error CS0433: The type ‘Erp.Tablesets.ETCAddrValidationTableset’ exists in both ‘d:\Epicor\Websites\EpicorTest10\Server\Assemblies\Erp.Contracts.BO.SalesOrder.dll’ and ‘d:\Epicor\Websites\EpicorTest10\Server\Assemblies\Erp.Contracts.BO.Quote.dll’ [CustomizationAdapter.cs(264,30)]
Error CS0433: The type ‘Erp.Tablesets.QuoteQtyTable’ exists in both ‘d:\Epicor\Websites\EpicorTest10\Server\Assemblies\Erp.Contracts.BO.SalesOrder.dll’ and ‘d:\Epicor\Websites\EpicorTest10\Server\Assemblies\Erp.Contracts.BO.Quote.dll’ [CreateOrder.CommonTypes.cs(281,33)]
Error CS0433: The type ‘Erp.Tablesets.HedTaxSumTable’ exists in both ‘d:\Epicor\Websites\EpicorTest10\Server\Assemblies\Erp.Contracts.BO.SalesOrder.dll’ and ‘d:\Epicor\Websites\EpicorTest10\Server\Assemblies\Erp.Contracts.BO.Quote.dll’ [CreateOrder.CommonTypes.cs(301,33)]
Error CS0433: The type ‘Erp.Tablesets.PartSubsTable’ exists in both ‘d:\Epicor\Websites\EpicorTest10\Server\Assemblies\Erp.Contracts.BO.SalesOrder.dll’ and ‘d:\Epicor\Websites\EpicorTest10\Server\Assemblies\Erp.Contracts.BO.Quote.dll’ [CreateOrder.CommonTypes.cs(306,33)]
Error CS0433: The type ‘Erp.Tablesets.TaxConnectStatusTable’ exists in both ‘d:\Epicor\Websites\EpicorTest10\Server\Assemblies\Erp.Contracts.BO.SalesOrder.dll’ and ‘d:\Epicor\Websites\EpicorTest10\Server\Assemblies\Erp.Contracts.BO.Quote.dll’ [CreateOrder.CommonTypes.cs(311,33)]
UGH… yeah this is a known issue… in short your are sh*t out of luck… IN reality you can get around it with an external DLL… but that’s painful.
Basically there are some BO’s that utilize the same DataSets and those datasets were not defined via Interface, rather the same exact dataset was created in BOTH DLL’s.
This is a known issue we’ve discussed in the past. You are going to have to either use an External DLL to invoke the method or not use the BO in this particular method.