Hello,
I am trying to create a cashHead within an Epicor Function and I got the following error : ```
System.ArgumentException: Tableset must contain extension table CSFCA.CashHead\r\n at Extensibility.CSF.Canada.PeerTable2..ctor(IceTableset tableset)\r\n at Extensibility.CSF.Canada.PeerCashHeadTable..ctor(IceTableset tableset)\r\n at Extensibility.CSF.Canada.CashRecExtension.ValidateBeforeUpdate(CashRecTableset cashRecTableset)\r\n at Extensibility.CSF.Canada.CashRecExtension.BeforeMethod(String methodName, IDictionary
2 parameters)\r\n at ConcreteClass164.BeforeMethod(String, IDictionary2)\r\n at Erp.Services.BO.CashRecSvcFacade.UpdateMaster(CashRecTableset& ds, String ipGroupID, String ipTableName, Boolean updGroupTotals, Decimal& opTotalCashReceived, Decimal& opTotalApplied, Decimal& opUnappliedBalance, Decimal& opTotalMisc, Decimal& opTotalDiscount, Decimal& opTotalDeposit, Decimal& opTotalARAmount, Decimal& opTotalWithhold, Decimal& opTotalWriteOff, Boolean& opUpdateRan, Int32 ipIgnoreValidation) in C:\\_releases\\ERP\\ERP11.3.100.8\\Source\\Server\\Services\\BO\\CashRec\\CashRecSvcFacade.cs:line 3412\r\n at EFx.ViridemAR.Implementation.ImportCaisseRecetteImpl.<>c__DisplayClass9_9.<Run>b__34(CashRecSvcContract bo)\r\n at Epicor.Customization.Common.CustomizationHelper.CallService[TService](Action
1 action, IHost host, IOperationLogger logger) in C:\_releases\ICE\ICE4.3.100.0\Source\Server\Customization\Epicor.Customization\Common\CustomizationHelper.cs:line 27\r\n at Epicor.Functions.FunctionBase3.CallService[TService](Action
1 action) in C:\_releases\ICE\ICE4.3.100.0\Source\Server\Customization\Epicor.Functions.Core\FunctionBase.Plugins.cs:line 44\r\n at EFx.ViridemAR.Implementation.ImportCaisseRecetteImpl.<>c__DisplayClass9_0.b__9(String pGrpID, Object pCashReceipt)
Here is my code :
Action<string, dynamic> CreateMiscCashReceipt = (pGrpID, pCashReceipt) =>
{
try
{
CallService<Erp.Contracts.CashRecSvcContract>(bo =>
{
var cashTs = new Erp.Tablesets.CashRecTableset();
bo.GetNewCashHeadType(ref cashTs, pGrpID, "MisPay");
var cashHead = cashTs.CashHead.FirstOrDefault(c => c.Added());
if (cashHead == null)
throw new Exception("Impossible de créer l'entête Miscellaneous");
string checkNum = pCashReceipt.CheckNum;
cashHead.CheckRef = checkNum;
decimal amount = pCashReceipt.Amount;
bo.ChangeTranAmtCashHead("D", amount, ref cashTs);
bo.GetTranAmt(false, ref cashTs);
bool outUpdate;
bo.PreUpdate(ref cashTs, out outUpdate);
decimal opTotalCashReceived;
decimal opTotalApplied;
decimal opUnappliedBalance;
decimal opTotalMisc;
decimal opTotalDiscount;
decimal opTotalDeposit;
decimal opTotalARAmount;
decimal opTotalWithold;
decimal opTotalWriteOff;
bool opUpdateRan;
bo.UpdateMaster(ref cashTs, pGrpID, "CashHead", true, out opTotalCashReceived, out opTotalApplied, out opUnappliedBalance, out opTotalMisc, out opTotalDiscount, out opTotalDeposit, out opTotalARAmount, out opTotalWithold, out opTotalWriteOff, out opUpdateRan, 2);
});
}
catch (Exception ex)
{
oSuccess = false;
_messageList.Add(ex.ToString());
}
};
Thanks,