Skip to main content
15-Moonstone
July 4, 2024
Solved

Auto revise in State Based Versioning via ECN

  • July 4, 2024
  • 2 replies
  • 985 views

Hi,

Trying to use State Based versioning ( numeric and alpha ).

Object starts in InWork state with numeric (1.0) revision, once object is released it should get auto revised to alpha (A.0)

Updated the revision file, created new series and seeds. Mapped to respective state in LC.

The challenge is when use ECN object gets released however it doesn't gets autorevised in Released State.

Manually revised it changes to Alpha revision.

Any references would be of great help.

 

 

Best answer by joe_morton

You'll need to add a robot with custom code in your ECN workflow, like HelesicPetr said.

Look at the solution here:  https://community.ptc.com/t5/Windchill/Revising-Using-Workflow/m-p/643#M89%3Fsource=search

 

The first line of that code won't work in your case, since it is for Promotion Objects and you want to use it for ECNs

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

 

This article shows how to get the Affected Objects and the Resulting Objects from an ECN: https://www.ptc.com/en/support/article/CS55955?source=search

 

Assuming you want to revise the Resulting Objects,  I'd try something like this:

try
{
wt.change2.WTChangeOrder2 ecn = (wt.change2.WTChangeOrder2)primaryBusinessObject;

wt.fc.QueryResult qr = wt.change2.ChangeService2.getChangeablesAfter(ecn);

while (qr.hasMoreElements()) {

wt.vc.Versioned obj = (wt.vc.Versioned) qr.nextElement();

wt.vc.Versioned newObject = wt.vc.VersionControlHelper.service.newVersion(obj);

wt.fc.PersistenceHelper.manager.store(newObject);

}
}
catch (wt.util.WTException ex)
{

}

2 replies

HelesicPetr
22-Sapphire II
22-Sapphire II
July 8, 2024

Hi @DKWc 

The autoRevision works just in Promotion Approval workflow.

For change process I would write own code based on the Promotion Approval revise robot to autorevise the resulting objects

//Promotion Approval Process has a Conditional robot with below code:
com.ptc.core.ui.validation.UIValidationResultSet set= com.ptc.windchill.enterprise.maturity.PromotionNoticeWorkflowHelper.revisePromotables(pn, pn.getCreator(), locale);

PetrH

joe_morton
18-Opal
18-Opal
July 8, 2024

You'll need to add a robot with custom code in your ECN workflow, like HelesicPetr said.

Look at the solution here:  https://community.ptc.com/t5/Windchill/Revising-Using-Workflow/m-p/643#M89%3Fsource=search

 

The first line of that code won't work in your case, since it is for Promotion Objects and you want to use it for ECNs

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

 

This article shows how to get the Affected Objects and the Resulting Objects from an ECN: https://www.ptc.com/en/support/article/CS55955?source=search

 

Assuming you want to revise the Resulting Objects,  I'd try something like this:

try
{
wt.change2.WTChangeOrder2 ecn = (wt.change2.WTChangeOrder2)primaryBusinessObject;

wt.fc.QueryResult qr = wt.change2.ChangeService2.getChangeablesAfter(ecn);

while (qr.hasMoreElements()) {

wt.vc.Versioned obj = (wt.vc.Versioned) qr.nextElement();

wt.vc.Versioned newObject = wt.vc.VersionControlHelper.service.newVersion(obj);

wt.fc.PersistenceHelper.manager.store(newObject);

}
}
catch (wt.util.WTException ex)
{

}

DKWc15-MoonstoneAuthor
15-Moonstone
July 15, 2024

Thanks a lot joe