Источник:
http://blogs.msdn.com/b/emeadaxsuppo...s-deleted.aspx
==============
In Dynamics AX it’s possible to add in document reference in many forms using the document handling functionality. However, when you sometimes delete a record that has an associated document reference; this reference in the DocuRef table remains. This is due to the fact that there is not always a relation between a table and DocuRef. Therefore if you run the consistency check report, you may find that you see lots of missing references found as the parent table record no longer exist.
One example of this is the ProdTable, for production orders. In order to make this function so that whenever you delete a record, it deletes the associated document reference follow these steps below (this example if for ProdTable, but just follow the same process for your required tables):
- From the AOT expand to Data Dictionary > Tables > DocuRef > Relations
- Add in a new relation – call it ProdTable
- Set the properties on this relation to point to the ProdTable
- Add in the following 3 relations (all relation type Normal)
- DocuRef.RefRecId == ProdTable.RecId
- DocuRef.RefRecTableId == ProdTable.TableId
- DocuRef.RefCompanyId == ProdTable.dataAreaId
- Save the DocuRef table.
- Next go to AOT > Data Dictionary > Tables > ProdTable > DeleteActions
- Add in a new Delete Action, set the properties to be:
- Table: DocuRef
- DeleteAction: Cascade
- Save the changes.
- Now when you run the consistency check you will not get any errors on ProdTable for new notes added. You may still see old records as these need to be manually cleaned.
Note: Please make sure that you have backups of application files and data before making changes.
author:Thomas Treeneditor:Thomas Treendate:18/Feb/2011
Источник:
http://blogs.msdn.com/b/emeadaxsuppo...s-deleted.aspx