Skip to main content
15-Moonstone
October 14, 2022
Solved

Automatic revision during promotion - no publish from the Released objects

  • October 14, 2022
  • 1 reply
  • 3279 views
 

Hi everyone,

 

We use a lifecycle template where an object uses numeric revision scheme when it is in the Development state but when it is Promoted to be released to production, it's automatically revised and the revisioning scheme is changed to alphabetical series.

 

Here is a pic from the PTC help describing a similar process:

 

AutoRevise.png

Otherwise the lifecycle works fine, but for some reason when an object is released to production through promote and auto-revise, it is not sent to the publisher and we don't get any visualizations or representations of it. The user needs to manually send the objects to the publisher in order to get PDF's and STEP's which is not great.

I found this article which tells some settings to enable publish on State Change:
https://www.ptc.com/en/support/article/CS115536

But we already have all those three wvs.properties set to true.

A colleague told that the Auto-Revise doesn't register as a State Change and for that reason those settings won't help with this situation.

Am I missing something or is this automatic revisioning feature just incomplete/broken?

Best answer by HelesicPetr

Hello @N-Pyn 

It is normal OOTB behavior. 

 

If the autorevision is used you have to add a specific code to a workflow to send the object to publish queue.

Following code can help to solve your issue.

 

 

try
{
	//H queue
	com.ptc.wvs.common.ui.PublisherAction pa = new com.ptc.wvs.common.ui.PublisherAction(com.ptc.wvs.common.ui.PublisherAction.QUEUEPRIORITY, "H");
	//all target object
	wt.fc.QueryResult promotables = wt.maturity.MaturityHelper.getService().getPromotionTargets((wt.maturity.PromotionNotice)primaryBusinessObject);
	while (promotables.hasMoreElements())
	{
		Object obj = (Object) promotables.nextElement();

		if (obj instanceof wt.epm.EPMDocument)
		{
			wt.epm.EPMDocument epmdoc = (wt.epm.EPMDocument) obj;

			//search latest version !!!!
			wt.vc.config.ConfigSpec configSpec = wt.vc.config.ConfigHelper.service.getDefaultConfigSpecFor(wt.epm.EPMDocument.class);
			wt.fc.QueryResult qr = wt.vc.config.ConfigHelper.service.filteredIterationsOf(epmdoc.getMaster(), configSpec);
			if (qr != null)
			{
				while (qr.hasMoreElements())
				{
					epmdoc = (wt.epm.EPMDocument)qr.nextElement();
				}
			}
			//get obj EPMDocument
			java.lang.String objRef;
			objRef = wt.fc.ObjectReference.newObjectReference(epmdoc).toString();
			//create publisher
			com.ptc.wvs.common.ui.Publisher pub = new com.ptc.wvs.common.ui.Publisher();
			//run publisher
			result = pub.doPublish(false, true, objRef, (wt.vc.config.ConfigSpec) null, (wt.vc.config.ConfigSpec) null, true, null, null, com.ptc.wvs.common.ui.Publisher.EPM, pa.toString(), 0);
		}//if
	}//while
} catch (wt.util.WTException e)
{
	e.printStackTrace();
}

 

 

 

PetrH

1 reply

HelesicPetr
22-Sapphire II
22-Sapphire II
October 14, 2022

Hello @N-Pyn 

It is normal OOTB behavior. 

 

If the autorevision is used you have to add a specific code to a workflow to send the object to publish queue.

Following code can help to solve your issue.

 

 

try
{
	//H queue
	com.ptc.wvs.common.ui.PublisherAction pa = new com.ptc.wvs.common.ui.PublisherAction(com.ptc.wvs.common.ui.PublisherAction.QUEUEPRIORITY, "H");
	//all target object
	wt.fc.QueryResult promotables = wt.maturity.MaturityHelper.getService().getPromotionTargets((wt.maturity.PromotionNotice)primaryBusinessObject);
	while (promotables.hasMoreElements())
	{
		Object obj = (Object) promotables.nextElement();

		if (obj instanceof wt.epm.EPMDocument)
		{
			wt.epm.EPMDocument epmdoc = (wt.epm.EPMDocument) obj;

			//search latest version !!!!
			wt.vc.config.ConfigSpec configSpec = wt.vc.config.ConfigHelper.service.getDefaultConfigSpecFor(wt.epm.EPMDocument.class);
			wt.fc.QueryResult qr = wt.vc.config.ConfigHelper.service.filteredIterationsOf(epmdoc.getMaster(), configSpec);
			if (qr != null)
			{
				while (qr.hasMoreElements())
				{
					epmdoc = (wt.epm.EPMDocument)qr.nextElement();
				}
			}
			//get obj EPMDocument
			java.lang.String objRef;
			objRef = wt.fc.ObjectReference.newObjectReference(epmdoc).toString();
			//create publisher
			com.ptc.wvs.common.ui.Publisher pub = new com.ptc.wvs.common.ui.Publisher();
			//run publisher
			result = pub.doPublish(false, true, objRef, (wt.vc.config.ConfigSpec) null, (wt.vc.config.ConfigSpec) null, true, null, null, com.ptc.wvs.common.ui.Publisher.EPM, pa.toString(), 0);
		}//if
	}//while
} catch (wt.util.WTException e)
{
	e.printStackTrace();
}

 

 

 

PetrH

N-Pyn15-MoonstoneAuthor
15-Moonstone
October 14, 2022

Thanks for the reply!

 

That's unfortunate that the publish process has not been taken into account when the auto-revise feature has been added. I think that it's a very crucial function of the PLM system to have up to date content on the objects at all times.

 

What workflow should I add this custom publish operation to?

I don't think adding this to the Promotion Approval Process workflow would work correctly because the automatic revisioning is happening after the promotion promotion process has been completed. So if I add this code to the end of the promotion process, the publish operation will be done to the object in the promotion process but then the object will be revised automatically to the new revision schema and that new revision will not have a representation.

HelesicPetr
22-Sapphire II
22-Sapphire II
October 14, 2022

Hi @N-Pyn 

Yes it is shame that autorevision does not care about visualization :D.

 

The Autorevision is done in the Approval Promotion Workflow

so if you add the code to the end of process then it will find latest revision and send it to publish queue with "H" priority

 

Trust me 😄

 

PetrH