CSFCA error while trying to create a CashHead

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, IDictionary2 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](Action1 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](Action1 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,

It looks like someone was able to get it working using the ChangeReceiptAmt instead of ChangeTranAmtCashHead here: MassGenerateCashDtl / GenerateCashDtl - #4 by Jeff_Owens

I’m not sure if that’s the issue, but you could try something like

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;
            cashHead.ReceiptAmt = amount;

            bo.ChangeReceiptAmt( 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());
    }
}; 

The first thing I am going to ask is has your Canada CSF pack been fully installed into the environment you are doing the development in?

Hello,

It is on Epicor SaaS I do hope it have been installed correctly.

Im surprised that it did not came with the tableset instanciation. I am wondering if they have another class that I should use.

Thanks,

-------- Message d’origine --------

Oh, Your profile mentions On-Prem.

I am sure if it wasn’t then there would be a whole lot of people complaining.

As a side note, proper information in your profile helps us to help you. Could you please update it?

Hello,

I work for an Epicor partner we have from E6 to k2024.1 on-prem and SaaS.

Tomorrow will test my code on one of my training environement without any csf

Thanks,

-------- Message d’origine --------

Pleas put versions ALL and Consultant Yes. If you are raising posts then include the version you are working on in your post.

Change made.

-------- Message d’origine --------

1 Like

Hello,

I have copied my code in an environment without CSF and my cashHead was created successfully.

No idea how to make it works in the environment containing the Canada CSF

Thanks,

Did you do a trace using the UI in the environment containing the CDN CSF?

Yes, we do not see the Extension Table in the trace.

I asked the tech team to install the CSF Canada on our training environment to validate if it is not an installation issue in the SaaS.

Are we sure the CSF uses the extension tables? Does the rest of the trace look the same as the base trace? The Doc* fields should contain the CDN amounts and the equivalent fields without the Doc prefix should be the amounts in the base currency. I might try doing a diff between the UI version that with the CAN CSF and the base version and look for differences there and not the extenstion table just to be sure.

Unless you’re saying the version with the CSF doesn’t work in the UI, then it’s an installation issue.

A couple of years ago, @tpynepeak had a CDN CSF issue. Not the same as you but he might have some pointers.

Both trace are identical between my CSF one and non-CSF.

And the UI works in both? Hmmm… :thinking:

Both are from Kinetic (F12) or the Classic client?

Both are Kinetic 2024.1 using classic screens.

the Extension tables are not directly under the .Tables in the tablesets but in .ExtensionTable that is probably why we do not see them in the trace.

Both UI Works

There have been some API changes to other objects using the browser in 2024.1 and the classic client was not updated. I’m curious if they are similar.

Of course, you’re using functions so it shouldn’t matter but just a thought.

Another thought. The Function is running under a different user context than the UI. Do you think there might be some client context (country, etc.?) being lost between the two?

I am not sure about this but normally country and csf are company related and not on the user.

I’ve seen CSF affect company, supplier, customer, and user/employee - tax treatment for example. Anyway, it was just a thought.