Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do you delete a DirParty record in Ax2012?
    text
    copied!<p>I have noticed that when you delete a Worker, the Person record still exists in DirPerson, DirPersonName, DirPartyTable (and a bunch of other related tables).</p> <p>I assume this is because of the complexities of the whole DirParty engin in Ax2012; probably to ensure that related tables which might contain data is not left without parent records. But why then is there a function in DirParty class that checks if a party can be deleted(DirParty:: canDeleteParty). I’ve also tried using the DirParty::autoDeleteParty method without success. Nothing gets deleted from the DirPartyTable. </p> <p>Example:</p> <pre><code>static void myLittleDirPartyDeleteJob(Args _args) { DirPartyTable dirPartyTable; DirPerson dirPerson; Common partyRecord; DirParty dirPartyClass; DirPersonRecId personRecId; ; select firstOnly * from dirPerson where dirPerson.name == "BONANI VIRGINIA NENGWEKHULU"; personRecId = DirPerson.RecId; //This is after the worker has been deleted on the HcmWorkerListPage form on HRM dirPartyTable = DirPartyTable::findRec(DirPerson::find(personRecId).RecId); if (dirPartyTable) { partyRecord = dirPartyTable; dirPartyClass = new DirParty(partyRecord); if (DirParty::canDeleteParty(dirPartyClass.getPartyRecId(),true)) { DirParty::autoDeleteParty(dirPartyTable.RecId); } } } </code></pre> <p>The above code does not delete anything, nor are there any errors that hits the debugger.</p> <p>I’ve tried putting it in transaction blocks (ttsbegin, ttscommit); selecting the record forupdate; I’ve even tried forcing a delete with DirPartyTable.doDelete()</p> <p>When trying any of the above I get the following error:” The value that you are trying to add or subtract creates an invalid utcdatetime”</p> <p>So my main question is: Is it possible to delete DirParty (and associated DirPerson; DirPersonName; etc.) tables, or will the party records forever be kept in the Dir* tables, even after deleting employees from the HRModule?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload