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