Quantcast
Channel: PTC Community : Unanswered Discussions - Windchill
Viewing all articles
Browse latest Browse all 3592

Create Change Request from Problem Report and Default to same Container

$
0
0

Hi,

 

I'm trying to auto-create the Change Request once the Problem Report has been confirmed (Accepted state).

I was able to do this with an Expression Robot from a PTC support site article using this code:

 

wt.change2.ChangeIssue ci =( wt.change2.ChangeIssue)primaryBusinessObject;

wt.change2.WTChangeRequest2 CRNew2 = wt.change2.WTChangeRequest2.newWTChangeRequest2();

CRNew2.setName(ci.getName());

CRNew2.setOrganization(ci.getOrganization());

wt.team.Team team = wt.team.TeamHelper.service.getTeam(ci);

if (team == null) {

team = wt.team.TeamHelper.service.getTeam(CRNew2);

}

CRNew2 = (wt.change2.WTChangeRequest2) wt.fc.PersistenceHelper.manager.save(CRNew2);

CRNew2 = (wt.change2.WTChangeRequest2) wt.fc.PersistenceHelper.manager.refresh(CRNew2);

//CRNew2.setCategory("Low");

System.out.println("IN ..Save...*********" + CRNew2.getNumber());

 

wt.change2.FormalizedBy fb = new wt.change2.FormalizedBy();

fb.setChangeIssue(ci);

fb.setChangeRequest2(CRNew2);

wt.fc.PersistenceServerHelper.manager.insert(fb);

 

This works to create the new ECR, but the problem is that it is created at the Site level, and not within whatever Context the Problem Report existed.

 

I know I'm missing something here.

Any idea what?

 

Thanks in advance,

Zack


Viewing all articles
Browse latest Browse all 3592

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>