Skip to main content
15-Moonstone
February 23, 2021
Solved

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

  • February 23, 2021
  • 3 replies
  • 4755 views

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?

3 replies

aachanta15-MoonstoneAuthor
15-Moonstone
February 24, 2021

any leads on this case please?

20-Turquoise
February 24, 2021

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"));

 

aachanta15-MoonstoneAuthor
15-Moonstone
February 25, 2021

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

aachanta15-MoonstoneAuthor
15-Moonstone
February 26, 2021

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

 

 

14-Alexandrite
February 28, 2021

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?