Proper way to use BPM to update OrderRel

,

@josecgomez

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.

https://epicweb.epicor.com/doc/Docs/Epicor10_ConvertedCode_ProgrammingGuide_101400.pdf#search=Converted%20Code

1 Like

@josecgomez

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)]

I am using CreateOrder on Quote.

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. :frowning:

1 Like

@josecgomez
Well that really sucks. I guess we are going the route of external dll’s. Thanks for you help.

BTW this was solved in 600+

2 Likes

@josecgomez
We created a dll and have imported it into epicor. Now, running this code we get a message that says we can’t mark buy-to-order and make direct. Any suggestions? We do not want it make direct.

using (var so = Ice.Assemblies.ServiceRenderer.GetService<Erp.Contracts.SalesOrderSvcContract>(Db))
				{
					var dp = so.GetByID(orderNum);   //variable 'ds' is changed to 'dp' since 'ds' is already used as a parameter
					for (int i = 0; i < dp.OrderRel.Count; i++)
					{
						if (dp.OrderRel[i].OrderLine == quoteDtl.OrderLine)
						{
							dp.OrderRel[i].RowMod = "U";							
							so.ChangeOrderRelBuyToOrder(true, ref dp);							
							so.Update(ref dp);
						}
					}
				}

I think its cause its already make direct you need to uncheck make direct and then check buy to order.

@josecgomez
How do we do that? i tried both of these before the so.ChangeOrderRelBuyToOrder line but get errors

so.ChangeMake(false, ref dp);
dp.OrderRel[i].Make = false;

@josecgomez
I am running this code:

using (var so = Ice.Assemblies.ServiceRenderer.GetService<Erp.Contracts.SalesOrderSvcContract>(Db))
				{
					var dp = so.GetByID(orderNum);   //variable 'ds' is changed to 'dp' since 'ds' is already used as a parameter
					for (int i = 0; i < dp.OrderRel.Count; i++)
					{
						if (dp.OrderRel[i].OrderLine == quoteDtl.OrderLine)
						{
							dp.OrderRel[i].RowMod = "U";						
						}
					}
					so.ChangeMake(false, ref dp);
					so.ChangeOrderRelBuyToOrder(true, ref dp);
					so.Update(ref dp);
				} 

This is the error we are getting.

Description: BPM runtime caught an unexpected exception of ‘EntityException’ type.
See more info in the Inner Exception section of Exception Details.
Inner Exception: The partner transaction manager has disabled its support for remote/network transactions. (Exception from HRESULT: 0x8004D025)
The partner transaction manager has disabled its support for remote/network transactions. (Exception from HRESULT: 0x8004D025)

Even if we comment out change make and changeorderrelbuytoorder we still get the error. Something else is missing.

Try this

using (var txScope = IceContext.CreateDefaultTransactionScope())
{

using (var so = Ice.Assemblies.ServiceRenderer.GetService<Erp.Contracts.SalesOrderSvcContract>(Db))
				{
					var dp = so.GetByID(orderNum);   //variable 'ds' is changed to 'dp' since 'ds' is already used as a parameter
					for (int i = 0; i < dp.OrderRel.Count; i++)
					{
						if (dp.OrderRel[i].OrderLine == quoteDtl.OrderLine)
						{
							dp.OrderRel[i].RowMod = "U";						
						}
					}
					so.ChangeMake(false, ref dp);
					so.ChangeOrderRelBuyToOrder(true, ref dp);
					so.Update(ref dp);
				} 
}

@danbedwards, @josecgomez

No luck. same error message.

Make sure you wrapped your full transaction with this. I think you started by using a foreach on QuoteDtl?

@danbedwards, @josecgomez

that allowed the code to run without errors however it doesn’t change the make direct nor buy to order. Make direct is still selected and buy to order is still unchecked.

We have it running on post processing on Quote.CreateOrder.

@danbedwards @josecgomez

This is the external method we are calling that runs but nothing seems to have changed:

public void CreateOrder(Erp.Tablesets.QuoteTableset ds, ref System.Int32 orderNum, ref System.String warningMessage, Ice.Tablesets.ContextTableset context)
		{
			using (var txScope = IceContext.CreateDefaultTransactionScope())
			{
				int ordNum = orderNum; 
				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 == ordNum) && pp.BuyToOrder == true
										  select new { OrderLine = orel.OrderLine }))
				{
					using (var so = Ice.Assemblies.ServiceRenderer.GetService<Erp.Contracts.SalesOrderSvcContract>(Db))
					{
						var dp = so.GetByID(orderNum); 
						for (int i = 0; i < dp.OrderRel.Count; i++)
						{
							if (dp.OrderRel[i].OrderLine == quoteDtl.OrderLine)
							{
								dp.OrderRel[i].RowMod = "U";
							}
						}
						so.ChangeMake(false, ref dp);
						so.ChangeOrderRelBuyToOrder(true, ref dp);
						so.Update(ref dp);
					}
				}

			}
		}

I am trying to do something very similar, updating the Sales Order Release NeedByDate from the Job Entry screen when we change the ReqDueDate.

    using(var so = Ice.Assemblies.ServiceRenderer.GetService<Erp.Contracts.SalesOrderSvcContract>(Db))
    {
        var dp = so.GetByID(oNum);
        for(int i=0; i> dp.OrderRel.Count;i++)
        {
            if(dp.OrderRel[i].OrderRelNum == oRel)
            {
                dp.OrderRel[i].RowMod="U";
                so.ChangeNeedByDate(ref dp, reqDueDate.ToString());
                so.Update(ref dp);
            }
        }
    }

I get a compilation error when saving the Method:

	There is at least one compilation error.
	Update.CommonTypes.cs(472,33): error CS0433: The type 'JobProdTable' exists in both 'Erp.Contracts.BO.JobEntry, Version=10.1.600.0, Culture=neutral, PublicKeyToken=5d3fa3c7105d7992' and 'Erp.Contracts.BO.SalesOrder, Version=10.1.600.0, Culture=neutral, PublicKeyToken=5d3fa3c7105d7992'
	Update.CommonTypes.cs(313,55): error CS0433: The type 'JobProdRow' exists in both 'Erp.Contracts.BO.JobEntry, Version=10.1.600.0, Culture=neutral, PublicKeyToken=5d3fa3c7105d7992' and 'Erp.Contracts.BO.SalesOrder, Version=10.1.600.0, Culture=neutral, PublicKeyToken=5d3fa3c7105d7992'

Does anyone have any idea on how to get past this issue?

You can create an external BPM or try using an in-tran data directive to get around this. I know a fix is coming to address this issue.

Jose,

We’ve run into the same sort of issue, although with SalesOrder and RMAProc. We’re in 10.1.400.28.

You indicated that the .Dll dataset conflict was resolved for 10.1.600; is this just for the SalesOrder / Quote dataset conflict, or were other dataset conflicts resolved as well ?

Thanks

Ken

BTW, not fixed in 10.2.100.6 in Kanban receipts with an inventory quantity receipts BO added.

Old thread but getting same error using SO BO from JobEntry update. We are on version 10.2.700.
Is it me or the bug still there? Thanks

There is at least one compilation error.
Update.CommonTypes.cs(492,33): error CS0433: The type ‘JobProdTable’ exists in both ‘Erp.Contracts.BO.JobEntry, Version=10.2.700.0, Culture=neutral, PublicKeyToken=5d3fa3c7105d7992’ and ‘Erp.Contracts.BO.SalesOrder, Version=10.2.700.0, Culture=neutral, PublicKeyToken=5d3fa3c7105d7992’
Update.CommonTypes.cs(328,55): error CS0433: The type ‘JobProdRow’ exists in both ‘Erp.Contracts.BO.JobEntry, Version=10.2.700.0, Culture=neutral, PublicKeyToken=5d3fa3c7105d7992’ and ‘Erp.Contracts.BO.SalesOrder, Version=10.2.700.0, Culture=neutral, PublicKeyToken=5d3fa3c7105d7992’