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

We are happy to announce the new Windchill Customization board! Learn more.

How to find uses of a team template?

PeterWigren
1-Newbie

How to find uses of a team template?

Hello!

I'm trying to delete a team template using below code:

PersistenceHelper.manager.delete(teamTemplateReference.getObject()

This produces the below stacktrace:

(wt.team.teamResource/26) wt.team.TeamException: The MyTeam team template is in use.  All uses must be removed before the MyTeam team template can be deleted.

wt.team.StandardTeamService$1.notifyVetoableEvent(StandardTeamService.java:307)

wt.events.StandardKeyedEventBranch.intDispatchEvent(StandardKeyedEventBranch.java:312)

wt.events.StandardKeyedEventBranch.dispatchVetoableMultiObjectEvent(StandardKeyedEventBranch.java:263)

wt.events.StandardKeyedEventDispatcher.intDispatchEvent(StandardKeyedEventDispatcher.java:288)

...

This exception does not give any cluses what is using the template but apperntly Windchill seems to know that it is used.

Does anyone know if there is an API to find out uses of a team template?

I have a feeling there is a generic way to do this...

Thanks and best regards,

Peter

2 REPLIES 2

During my research I found out that the below code will give me the team that is using my template.

So now I just need to figure out how to remove the teamtemplate from the team.

Anyone who knows how this can be done?

WTContainerRef orgContainerRef = getOrgContainerRef();
            TeamTemplateReference teamTemplateOrgRef = getTeamTemplateReference(orgContainerRef, "MyTeam");

            StandardTeamService sts = StandardTeamService.newStandardTeamService();
            Vector uses = sts.whereUsed(teamTemplateOrgRef);

            for(int i=0; i<uses.size(); i++){
                Object o = uses.get(i);

                if (o instanceof ObjectReference) {
                    ObjectReference or = (ObjectReference) o;
                    Persistable p = or.getObject();

                    if(p instanceof Team){
                        Team team = (Team) p;

Best regards,

Peter

Hello Peter. I don't have the answer to your question. However, I am having the same issue. I have advanced admin rights within my company and still hitting a brick wall. I want to delete three obsolete templates and I can't due to the "uses" message. However, like you, I have no clue on how to find these uses and then address them so that I might delete these obsolete templates. I have Googled also in search of a solution with no success. In my opinion PTC should address this issue. It seems to be a black hole. I just wanted to let you know that you weren't alone with this issue. J

Top Tags