Programmatically set OrderHed.ReadyToCalc E10.1.600.4

I use Epicors WCF services to update a lot of my data. I’ve been toggling OrderHed.ReadyToCalc in this way for quite some time. However it’s been brought to my attention that some BookDtl records are missing. If I manually uncheck and check Ready to Process in Order Entry it seems to resolve it. When I do the same through DMT I get the following error (even though there is an error in dmt the data seems to get fixed).

{ORDERNUM} Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints.

Table: OrderRelTax
Company=’{COMPANY}’ OrderNum=’{ORDERNUM}’ OrderLine=’{ORDERLINE}’ OrderRelNum=’{ORDERRELNUM}’ TaxCode=‘AVA0000045’ RateCode=‘AVALARA’ ECAcquisitionSeq=‘0’ SysRowID=’{SYSROWID}’: ForeignKeyConstraint OrderRelOrderRelTax requires the child key values ({COMPANY}, {ORDERNUM}, {ORDERLINE}, {ORDERRELNUM}) to exist in the parent table.

Currently I update ReadyToCalc with a method similar to the bellow code (interaction.SalesOrderClient is just a reference to Erp.BO.SalesOrderSvc).

bool value = true;
var soTableSet = interaction.SalesOrderClient.GetByID(orderNum);
Guid sysRow = soTableSet.OrderHed.Single().SysRowID;
if (value)
{
soTableSet.OrderHed[0].RowMod = “U”;
soTableSet.OrderHed[0].ReadyToCalc = value;
soTableSet.OrderHed[0].CurrencySwitch = false;
interaction.SalesOrderClient.SetReadyToCalc(orderNum, ref soTableSet);
soTableSet = interaction.SalesOrderClient.GetBySysRowID(sysRow);
}

soTableSet.OrderHed[0].ReadyToCalc = value;
soTableSet.OrderHed[0].CurrencySwitch = false;
soTableSet.OrderHed[0].RowMod = “U”;
interaction.SalesOrderClient.Update(ref soTableSet);

Are there additional fields that should be set or methods that should be called to prevent this from happening or repair it if I encounter it again? Right now I’m at a loss. Currently our version is 10.1.600.4 and we do use tax connect. Let me know if you need more info.

Is Ready to Process at the Company level set to true? That will make every order that is created be created with the Ready to Process flag on.

Right now that is not turned on but I don’t think it would help me. I need to check and uncheck that box multiple times throughout the life of the order.

Do a trace of this process in the application and look at the paramter fields at the end that it actually updates and that will tell you if you are missing a field. Rather than guess and which fields I always do that and know right away from .Update method expects to be populated in a dataset.

Good luck,
Aaron

Unfortunately the trace doesn’t help. There seems to be other things going on other than whats traced. If I do only what’s shown in the trace OrderRelTax and BookDtl records wont be generated.

Hmm I don’t use the Epicor WCF services for these kinda reasons. I use my own I built and call Erp.Proxy.BO.SalesOrderImpl as my reference file and I can set whatever I need to and I can rely a trace, or use service connect as a last resort to see what all fields are required for a particular function.