cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X

Can any one tell me how I can delete Latest Iteration of WTDocument

ptc-3953915
1-Newbie

Can any one tell me how I can delete Latest Iteration of WTDocument

Hello,

I am stuck in one place I guess any one of you can help me, basically I am trying to delete the latest Iteration of the WTDocument using

PersistenceHelper.manager.delete(persistable);

where persistable object is latest iteration of WTDocument but when I execute the method it delete the entire version of the object

Can any one help me how I can delete only latest iteration of object

1 ACCEPTED SOLUTION

Accepted Solutions

Hi Ankit,

You can use the following Code to delete the latest iteration,

wt.vc.wip.Workable iterationObj = null;

boolean isLatestIteration = false;

wt.fc.QueryResult result = wt.vc.VersionControlHelper.service.allIterationsFrom((wt.vc.Iterated)WTObject);

while (result.hasMoreElements() ){

WTObject tmpObj = (WTObject)result.nextElement();

if(WTObject instanceof WTPart){


WTPart part = (WTPart)tmpObj;

isLatestIteration = part.isLatestIteration();

if(isLatestIteration){

iterationObj(part);

break;

}

}

}

if( isLatestIteration ){


wt.vc.VersionControlHelper.service.deleteIterations((wt.vc.Iterated)iterationObj,(wt.vc.Iterated)iterationObj);





strLogger.append(" :: Object Deleted :: Yes" );

}

BR

MKR

View solution in original post

2 REPLIES 2

Take a look at VersionControlHelper.service.deleteIterations. Not sure if theres a deleteLatest, so getting the iteration you want to delete may be up to you.

Message was edited by: Matthew Knight. Fixed typo

Hi Ankit,

You can use the following Code to delete the latest iteration,

wt.vc.wip.Workable iterationObj = null;

boolean isLatestIteration = false;

wt.fc.QueryResult result = wt.vc.VersionControlHelper.service.allIterationsFrom((wt.vc.Iterated)WTObject);

while (result.hasMoreElements() ){

WTObject tmpObj = (WTObject)result.nextElement();

if(WTObject instanceof WTPart){


WTPart part = (WTPart)tmpObj;

isLatestIteration = part.isLatestIteration();

if(isLatestIteration){

iterationObj(part);

break;

}

}

}

if( isLatestIteration ){


wt.vc.VersionControlHelper.service.deleteIterations((wt.vc.Iterated)iterationObj,(wt.vc.Iterated)iterationObj);





strLogger.append(" :: Object Deleted :: Yes" );

}

BR

MKR

Top Tags