Friday, 8 February 2013

Delete Private AOT projects in AX 2012

This is a common problem since the old days. People leave projects in their private project and no one can get to it to clean it up.

In pre AX2012, it was a matter of selecting the utilElements and calling the AOTDelete method. I won’t go through it here.

In AX2012, it is all maintained in the model store.

Let see it in pictures.

Below are the projects you want to delete.


You can see them in the SysModelElement table. It is in the system tables section.


I wrote a job to loop through and delete them. I had to

static void deleteAllProjectObjects3(Args _args)

SysModelElement sysModelElement;
ProjectNode privatePn;
ProjectNode pn;
utilElementName shortName;
int len;
str preFix;

// Navigate to the Private projects folder.
privatePn = infolog.projectRootNode().AOTfindChild("Private");

preFix = curuserid()+'_';
len = strlen(preFix);

while select sysModelElement
where sysModelElement.ElementType == 38
//&& sysModelElementName like "*TestProj*"
// remove <userId>_ from the _projectName to get the name used in the Projects tree for a private project
if (substr(sysModelElement.Name, 1, len) == preFix)
shortName = strdel(sysModelElement.Name, 1, len);

// Get a reference to the project.
pn = privatePn.AOTfindChild(shortName);



Use at your own discretion. No guarantees here.


nathan clouse said...

for 2009, what if you have a private project that the client just hangs on when you actually scope it and do an AOTDelete()?

index said...
This comment has been removed by the author.
index said...

There is much safer description of how you can get access to all private projects and delete them: