Interactive Grid when used with Apex Collections brings some great features. But currently it needs a lot of manual setup. Also currently the validations can't be run natively on IG based on apex collections. So I need to create validations for collection values instead of using interactive grid features for collections. The same applies to dynamic actions too.
I have developed some apps where users could save data temporarily in apex collections for child table as well as parent table and then submit both together with apply button on parent screen.
When user clicks on apply button, the data from IG is saved in Collections with “After Submit” process which is the only process point where I am able to use IG values to update/insert collection members by invoking apex_collection api's add_member or update_member procedures while selecting the editable region as the IG region.
The validations or processes beyond the “after submit” process point do not consider the IG values natively.
This blog explains the approach - https://madwithapex.blogspot.com/2017/06/apex-collections-with-interactive-grid.html
Preferred Solution (Optional)
- Allow developers to select apex collections as a source for IG with collection name mentioned in a field.
- Ask developers if they want to truncate and recreate the collection when user arrives the current page or use the collection already created by some process.
- When a user clicks on save button, an IG process should natively run validations on IG columns like how it works for normal db tables, and then at the Processing point it should use apex_collection.add_member, apex_collection.update_member or apex_collection.delete_member procedures based on the row status for each row.