Journal Batches Disappear

Recently our support group discovered that Journal Batches for all users were disappearing from General Journal pages. Customization of the Item Journal page (General Ledger Balancing Account and a trigger to raise General Journal entries was added) resulted in the component allowing all created user batches to disappear.

The first code which was the culprit, worked well in the development environment but failed in the production / live environment.

The calling code

DeleteJournalLine;

The function
//Beginning first code
DeleteJournalLine()

WITH ItemJnlLine DO BEGIN
JournalLine.RESET;
JournalLine.SETFILTER(“Journal Template Name”,“Journal Template Name”);
JournalLine.SETFILTER(“Journal Batch Name”,“Journal Batch Name”);
IF JournalLine.FIND(’-’) THEN
JournalLine.DELETEALL;
END;
//End first code

The second code which corrected issue at the production / live environment.

The calling code

DeleteJournalLine(ItemJnlLine);

The function
//Beginning second code

DeleteJournalLine(ItemJnlLine : Record “Item Journal Line”)
WITH ItemJnlLine DO BEGIN
JournalLine.RESET;
JournalLine.SETFILTER(“Journal Template Name”,“Journal Template Name”);
JournalLine.SETFILTER(“Journal Batch Name”,“Journal Batch Name”);
IF JournalLine.FIND(’-’) THEN
JournalLine.DELETEALL;
END;
//End second code

HI,

what’s the questiuon here?

Ernst

I forgot to mention what tables the two main record variables represented.

ItemJnlLine varaible holds Item Journal Line table

JournalLine variable holds Gen. Journal Line table

What role did the parameter play in resolving the issue, technical details.

Yes but, like Ernst writes, then you didn’t write exactly what your problem is or what you’re trying to accomplish.

The problem domain: Client wants to process item journal like a financial account entry which should hit the ledger entry upon posting, the item journal posting is modified to this and a delete command is issued after all processing (posting) with reference to the gen journal entry to clear the records from gen journal table.

The delete code is inserted into codeuint 22 and ended up deleting all batches in the gen journal table from all users( zapping the table), including batches not in any way related to the item journal batches being passed.

The question is why should that happen with the first code but not with the second code. The only thing that changed between the two codes is a record parameter added to the second code. Why did that make a difference, in other development environments the first code would work without any issues.

The problem domain: Client wants to process item journal like a financial account entry which should hit the ledger entry upon posting.

Item journal posting is modified to do this.

A delete funtion is issued after all processing (posting) with reference to the gen journal entry to clear the records from gen journal table.

The delete function is inserted into codeuint 22 and ends up deleting all batches in the gen journal table from all users( zapping the table), including batches not in any way related to the item journal batches being passed.

The question is why should that happen with the first code but not with the second code.

The only thing that changed between the two codes is a record parameter added to the second code.

Why did that make a difference, in other development environments the first code would work without any issues.