"General ledger" entity Import issue

If I’m creating a line in the General ledger journal manually, then when I’m selecting a customer the system is checkng the AutoSettle setup in the custParameters and since it’s set to True, the system sets ledgerjournalTrans.SettleVoucher = OpenTransations

When I’m importing the same journal as a csv file via Data Management and choose std General Ledger Entity , the SettleVoucher field on the imported lines does not get populated. I’m trying to debug the entity code(LedgerJournalEntity) to understand the reason.
I see at no point the settleVoucher population … Also I see no any calls to for example to accountModified() on ledgerJournalTrans (or something similar) to set relevant fields based on the selected customer. Am I missing something? Is it a bug? Or is it so deliberately or am I just looking in a wrong place. Please help !!

I’m looking at an older version of the application (something I have on my local machine), therefore it might look differently in your case, but I see a call of updateLedgerJournalTransSettleVoucher() in LedgerJournalEntity::copyCustomStagingToTarget().
You could also use LedgerJournalLineEntity which calls ledgerJournalTrans.setSettleVoucher() in insertEntityDataSource().

1 Like

Thank you very much Martin! The thing is that my debugger was never entering those methods despite having breakpoints there, but thanks to you I revisited copyCustomStagingToTarget() again and noticed that in the comments above the method it says that the method is not triggered if the entity has AllowSetBased set to false. If not , the code is just skipping all the logic to gain the performance. I’ve checked the setup and client’s entity was set as SetBased = false. Now I have to understand why after setting SetBased = True the voucher numbers stopped being assigned upon import which was working before the change …Never a dull moment
PS: Found that the voucher should be specified in the import file in case of set-Based
import Importing vouchers by using the General journal entity - Finance & Operations | Dynamics 365 | Microsoft Learn

Actually I still don’t quite understand MS logic here:
I’ve setBased = True on the entity and now the settleVoucher gets populated , i.e I’m getting into the copyCustomStagingToTarget(). This method populates a lot of default fields.
If setBased = False then the default logic is not run

Why is designed that way? Are we in the case of SetBased = false supposed to populate all the fields in the file to be imported rather than relying on AX populating it based on parameters and setups (i.e including settleVoucher)?

When I check DMFEntityWriter.writeV2 , I get it as if the TargetIsSetBased = False,then we just copy data from staging directly to journals. Therefore if the settleVoucher is not present in the the generalJournal entitity field list , I won’t be populated in the jouranl lines. Theerfore, do I understand it correctly that it’s impossible(without customisations) to get settleVoucher populated if entity has setBased = False ?