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

Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X

Get list of Resulting Objects from ECN in a Workflow

sdrzewiczewski
7-Bedrock

Get list of Resulting Objects from ECN in a Workflow

At the end of our ECN process I'd like to add additional information to the email notification. I've already done this for the Promotion Process, where I list out all the Parts, Documents and CAD Docs that have changed including their number, revision and name. and also a list of all the approver/reviewers comments.

I'd like to be able to get similar information into the email notification for the ECN Process. First piece that I want to tackle is the list of ECN resulting objects. I think I would use the following

QueryResult queryresult = ChangeHelper2.service.getChangeablesAfter(wt.change2.WTChangeOrder2);
And then iterate through the QueryResult to build my strings to output to the email body.
Has anybody anything similar and have some code snippets to share?
Thanks,
Steve D.
2 REPLIES 2

Thanks to Dax and Dave for verifying that I was on the right path... Below is some of the code I used to summarize the parts for the completed ECN

String myPartsList =";

String myDocsList =";

String myCadList =";

String myList =";


Integer iParts = 0;

Integer iDocs = 0;

Integer iCad = 0;


wt.fc.QueryResult queryresult = wt.change2.ChangeHelper2.service.getChangeablesAfter( (wt.change2.ChangeOrderIfc) primaryBusinessObject);


//wt.maturity.PromotionNotice pn = ((wt.maturity.PromotionNotice)primaryBusinessObject);

//wt.fc.QueryResult queryresult = wt.maturity.MaturityHelper.service.getPromotionTargets(pn);


while (queryresult.hasMoreElements())

{

wt.fc.WTObject obj = (wt.fc.WTObject) queryresult.nextElement();


if (obj instanceof wt.part.WTPart){

iParts ++;


myPartsList+=((wt.part.WTPart)obj).getNumber() + " - ";


wt.vc.Versioned verobj = (wt.vc.Versioned) obj;

myPartsList+= "rev" + wt.vc.VersionControlHelper.getVersionIdentifier(verobj).getValue();


myPartsList+= " - " + ((wt.part.WTPart)obj).getName() + "\n";


} else if (obj instanceof wt.doc.WTDocument){

iDocs ++;

myDocsList+=((wt.doc.WTDocument)obj).getNumber() + " - ";


wt.vc.Versioned verobj = (wt.vc.Versioned) obj;

myDocsList+= "rev" + wt.vc.VersionControlHelper.getVersionIdentifier(verobj).getValue();


myDocsList += " - " + ((wt.doc.WTDocument)obj).getName() + "\n";


} else if (obj instanceof wt.epm.EPMDocument){

iCad ++;

myCadList+=((wt.epm.EPMDocument)obj).getNumber() + " - ";


wt.vc.Versioned verobj = (wt.vc.Versioned) obj;

myCadList+= "rev" + wt.vc.VersionControlHelper.getVersionIdentifier(verobj).getValue();

myCadList+= " - " + ((wt.epm.EPMDocument)obj).getName() + "\n";

}

}


if (iParts > 0) {

myList += "Parts\n---------------------\n" + myPartsList + "\n\n";

}


if (iDocs > 0) {

myList += "Documents\n---------------------\n" + myDocsList + "\n\n";

}


if (iCad > 0) {

myList += "CAD Files\n---------------------\n" + myCadList + "\n\n";

}


summaryOfItems=myList;

I commented out the piece that would work for a Promotion Notice too.
Top Tags