Page 1 of 1

Custom Collection Items

PostPosted: Wed Nov 11, 2020 8:07 am
by SBarnes
I need to have a custom collection and custom collection item that will get displayed in Debtor Maintenance and updated when debtor saves, the additional table that is being added to hold this data will have foreign keys to debtor, inventory classification and an inventory category, I am aware of the following things:

1. Makes sure the table is setup with cascading deletes so the database will still allow Jiwa to delete debtors for example and clean up my table as well
2. The collection Item save should not start a transaction nor should it perform a commit or rollback, where a rollback is concerned or would normally occur throw an exception.
3. Check in the save start of the debtor that everything is valid in the collection for the save and then in the save end of the debtor save the collection
4. In the create, read and copy of the debtor take appropriate action for custom collection namely clear, read and clear respectively

Are there any other gotchas I should be aware of beside these to make it work?

Re: Custom Collection Items  Topic is solved

PostPosted: Thu Dec 17, 2020 8:41 pm
by Mike.Sheen
SBarnes wrote:3. Check in the save start of the debtor that everything is valid in the collection for the save and then in the save end of the debtor save the collection


The SaveEnd event is too late - you want to perform your database operations in the SaveEnding.

It will work, but you're no longer riding the same transaction we created and used for our save operation - so if your SaveEnd handler throws an exception, it won't cause our save to rollback - and that's not what you want.

Everything else is spot-on, though!

Re: Custom Collection Items

PostPosted: Fri Dec 18, 2020 8:00 am
by SBarnes
ok I'll have a look at the save ending as I am currently using the the save end but have it all working at present but I get your point about being inside the same transaction will make sure its an all or nothing result.