Problem with Delete


I am using ax2012

i have two tables table1 and table 2.

table1 RecId is stored in a field1 of table2.

table1 is displayed in a ListPage Grid.

so whenever i delete a record of table1, the recid of the table1 which is stored in table2 should be set to 0 or null…

how to do this… can anyone help me…

Note: i have tried to write DeleteAction for table1. if i write deleteaction for table1,the entire record in table2 gets deleted… i want only that particular field of table2 to get deleted…

Preferably change the data model. E.g. let Table1 refer to Table2 - deleting Table1 won’t leave any orphaned references. Or you can create a record in a reference table that will be deleted by a delete action.

If you need to update references in other tables, you’ll have to write code for it. delete() method of Table1 would be the right place.