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

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

How to set the ECR to resolved when few ECN are Resolved and others are Canceled

aachanta
15-Moonstone

How to set the ECR to resolved when few ECN are Resolved and others are Canceled

Hi All,

 

Can anyone let me know how to set the ECR to resolved programmatically even if one ECN is resolved and others are Cancelled?

 

I checked on the code within the Synch on Change Notice Implementation where it has a code like below 

.WorkflowProcessHelper.isRelatedChildrenInStates(

primaryBusinessObject,
new String[]{"RESOLVED"})) {
result = "Resolved";
}

 

 

So what if there are multiple ECN where few are resolved and few are cancelled and how to make sure that ECR is resolved even if one ECN is Resolved. Can we modify the code? If yes can someone provide their leads here?

ACCEPTED SOLUTION
7 REPLIES 7
aachanta
15-Moonstone
(To:aachanta)

any leads on this case please?

RandyJones
20-Turquoise
(To:aachanta)

One way is to use WorkflowProcessHelper to set the resolution date and to use LifeCycleHelper to set the state:

WTChangeRequest2 ecr = <TheECRInQuestion>;
WorkflowProcessHelper.setResolutionDate(ecr);
LifeCycleHelper.service.setLifeCycleState(ecr, State.toState("RESOLVED"));

 

aachanta
15-Moonstone
(To:RandyJones)

Hi Jones

 

Thanks for letting me know.

 

I checked the workflow and see within the synch on change notice completion expression the below code is already there

 

if(com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.isRelatedChildrenInStates((wt.lifecycle.LifeCycleManaged)primaryBusinessObject, new String[]{"RESOLVED"})) {
result = "Resolved";
} else if(com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.isRelatedChildrenInStates((wt.lifecycle.LifeCycleManaged)primaryBusinessObject, new String[]{"CANCELLED"})) {
result = "Cancelled";
}

 

Post that there is also another expression robot in the workflow where it sets the change request to resolved and sets the resolution date

 

com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.setResolutionDate((wt.change2.VersionableChangeItem)primaryBusinessObject);

 

The same for Cancelled Routing as well. I attached a screenshot of the same. My request would be if we can change the synch on change notice completion expression itself so that regardless of how many ECN's that are present for the ECR, even if one ECN gets resolved it should be choosing the resolved routing option and not a Cancelled Routing and also it should not be stuck waiting for manual execution of that sync expression.

 

So can we modify the synch on the Change notice completion expression so that the workflow chooses a resolved routing and does not get stuck up when there are both resolved and canceled change notices.

 

Best Regards,

Aditya

aachanta
15-Moonstone
(To:aacciano3)

Hi Acciano,

 

I saw this post

 

But this was only relevant if all ECN to be either Resolved or all ECN being Cancelled.

 

So can I get any ECR being resolved when I have more than one ECN with a few being Resolved and Canceled?

 

Best Regards.

Aditya

 

 

aacciano3
14-Alexandrite
(To:aachanta)

Hi @aachanta 

 

Have you tried CS294111?

Seems to me that the code in Scenario 1 is what you will need, per the table (row 3).

Am I missing something?

aachanta
15-Moonstone
(To:aacciano3)

Hi @aacciano3 

 

It was perfectly working for me for all the new ECR where if the ECN is a combination of both Resolved and Canceled.

 

But is there a way to get the previous ECR also resolved which fall into the same scenario? As once I change the sync on change notice implementation it shall be setting the ECR to resolved (if ECN is Cancelled /  Resolved) for the future ECR but not the ECR that was created in the past.

 

So how to get this implemented for the old ECR as well which is not following the latest workflow iteration? Is there a way where we can get this done? Any utility has to be written or a listener or with any workflow code update, this shall work?

 

Best Regards.

Aditya

Announcements

Top Tags