dynamics ax 2012 - How do you delete a DirParty record in Ax2012? -


i have noticed when delete worker, person record still exists in dirperson, dirpersonname, dirpartytable (and bunch of other related tables).

i assume because of complexities of whole dirparty engin in ax2012; ensure related tables might contain data not left without parent records. why there function in dirparty class checks if party can deleted(dirparty:: candeleteparty). i’ve tried using dirparty::autodeleteparty method without success. nothing gets deleted dirpartytable.

example:

static void mylittledirpartydeletejob(args _args) {     dirpartytable       dirpartytable;     dirperson           dirperson;     common              partyrecord;     dirparty            dirpartyclass;     dirpersonrecid      personrecid;     ;      select firstonly * dirperson dirperson.name == "bonani virginia nengwekhulu";     personrecid = dirperson.recid;      //this after worker has been deleted on 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);         }                 } } 

the above code not delete anything, nor there errors hits debugger.

i’ve tried putting in transaction blocks (ttsbegin, ttscommit); selecting record forupdate; i’ve tried forcing delete dirpartytable.dodelete()

when trying of above following error:” value trying add or subtract creates invalid utcdatetime”

so main question is: possible delete dirparty (and associated dirperson; dirpersonname; etc.) tables, or party records forever kept in dir* tables, after deleting employees hrmodule?

please note inside autodeleteparty method there check if autodeleteparty parameter set before deleting, or can use code inside in job.

regards, sebastian


Comments

Popular posts from this blog

php - Why I am getting the Error "Commands out of sync; you can't run this command now" -

linux - Does gcc have any options to add version info in ELF binary file? -

java - Are there any classes that implement javax.persistence.Parameter<T>? -