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

Community Tip - Need help navigating or using the PTC Community? Contact the community team. X

ECR Change Classification in the ECN

jlittle
6-Contributor

ECR Change Classification in the ECN

I need to add a conditional to the ECN workflow that is dependent on the change classification of the ECR. Basically, if the ECR classification is equal to "Obsolete" then take this route, otherwise, take this route. I am struggling with the syntax and possibilities within the workflow editor. Any help would be appreciated.

Regards,

James Little

5 REPLIES 5
jlittle
6-Contributor
(To:jlittle)


Anyone have any suggestions for this? I would really appreciate some help or insight.

Thanks,

In Reply to James Little:

I need to add a conditional to the ECN workflow that is dependent on the change classification of the ECR. Basically, if the ECR classification is equal to "Obsolete" then take this route, otherwise, take this route. I am struggling with the syntax and possibilities within the workflow editor. Any help would be appreciated.

Regards,

James Little

Hi James

It is very straight forward.



1. Edit ECN workflow,

2. Add conditional router in appropriate place

a. Choose Conditional as Routing Type

b. Add Routing events within Routing Events pan

c. Under Routing Expression, find the ECR using API like QueryResult
result = QueryResult queryresult =
ChangeHelper2.service.getChangeRequest((wt.change2.WTChangeOrder2)primaryBus
inessObject), true);

d. From the queryresult get the ECR

e. Find ECR Classification

f. if (ecrClassification.equals("obsolete")) result =
"Obsolete_Route"; else result = "route2";



if you need any specific clarifications, please shoot me a line or give me a
call.





Thank you and have a great time.

Best Regards

Swamy Senthil

Principal Solutions Architect

973 216 0456(M); 973 324 2729(W); 866 908 6561(F)

Work Email: swamy.senthil@swasen.com

LinkedIn Profile:
jlittle
6-Contributor
(To:jlittle)

Thanks for the input. Let me try it on our development server and see
the results.

I appreciate your response.

James Little
Corning Cable Systems
CAD Administrator
Jeremiah 33:3 "Call to Me, and I will answer you, and show you great and
mighty things, which you do not know."

avillanueva
22-Sapphire I
(To:jlittle)

Here is my conditional:

if
(customization.workflow.GoodrichWorkflowProcessHelper.isValidAutoAccept(
(wt.change2.WTChangeRequest2)primaryBusinessObject))

{


ECCreator=customization.workflow.GoodrichWorkflowProcessHelper.getECRCre
ator((wt.change2.WTChangeRequest2)primaryBusinessObject);

ccbcDecision="Approve";

analysisComments="Auto-Accepted";

approvalDate=new
java.sql.Timestamp(System.currentTimeMillis());


com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.setTr
ack((wt.change2.WTChangeRequest2)primaryBusinessObject, "SIMPLE");

result="Accept";

}

else

{


com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.setTr
ack((wt.change2.WTChangeRequest2)primaryBusinessObject, "COMPLEX");

result="Continue";

}





But the code you want is here (externalized):

public static boolean isValidAutoAccept(WTChangeRequest2 ecr) throws
WTException

{

Category category=ecr.getCategory();

//if we have an auto-acceptable category

if
((category==Category.toCategory("INITIAL_RELEASE"))||(category==Category
.toCategory("ENG_ERROR")))

{

//and the creator is part of the Product area team
(CONFIRMED)

ContainerTeamManaged containerteammanaged =
(ContainerTeamManaged)ecr.getContainer();

Enumeration enumeration =
((ContainerTeam)containerteammanaged.getContainerTeamReference().getObje
ct()).getMembers().elements();

while(enumeration.hasMoreElements())

{

WTPrincipalReference wtprincipalreference =
(WTPrincipalReference)enumeration.nextElement();

WTPrincipal wtprincipal =
(WTPrincipal)wtprincipalreference.getObject();

if(wtprincipal instanceof WTUser)

{

WTUser wtuser = (WTUser)wtprincipal;

if (wtuser.getName().equals(ecr.getCreatorName()))

return true;

}

}

}

return false;

}




James, this is the helper class that has all your business logic. Just add another method to it and call it from the workflow as suggested below.
Top Tags