Skip to main content
1-Visitor
June 29, 2015
Solved

Windchill Workflow Templates - Publish at certain points

  • June 29, 2015
  • 2 replies
  • 3170 views

Good Morning all,

As you can see from below this is my current promotion request.

At the areas circled in red I would like the workflow to re publish the file (will only ever be .asm .prt or .drw)

The reason being is that the workflow changes the state and on our standard border displays the state.

PromotionRequest.png

Best answer by metherington

Issue was resolved by setting republishonepmdocumentchange = true

 

xconfmanager -p -t D:\PTC\WC\Windchill\codebase\wvs.properties -s "publish.republishonepmdocumentchange=true"

 

Please see PTC CS115536 for rough details (Ignore prevent check in section)

2 replies

1-Visitor
June 29, 2015

you can use below code to publish all promotable.

public static void publishReleaseDocument(PromotionNotice primaryBusinessObject) throws WTException {

  wt.fc.QueryResult qr = wt.maturity.MaturityHelper.service.getPromotionTargets((PromotionNotice) primaryBusinessObject);

 

  while (qr.hasMoreElements()) {

  RevisionControlled obj = (RevisionControlled) qr.nextElement();

  if (obj.getClass().isAssignableFrom(EPMDocument.class)) {

  QueryResult allIteration = VersionControlHelper.service.allIterationsOf(obj.getMaster());

  ;

  if (allIteration != null && allIteration.hasMoreElements()) {

  Persistable docs = (Persistable) allIteration.nextElement();

  String objRef = ObjectReference.newObjectReference((Persistable) docs).toString();

  ConfigSpec configSpec = new LatestConfigSpec();

  com.ptc.wvs.common.ui.Publisher pub = new com.ptc.wvs.common.ui.Publisher();

  com.ptc.wvs.common.ui.PublisherAction action = new com.ptc.wvs.common.ui.PublisherAction();

  action.addAction(com.ptc.wvs.common.ui.PublisherAction.QUEUEPRIORITY, "H");

  boolean result = pub.doPublish(true, true, objRef, configSpec, configSpec, true, "", "Created By Workflow", com.ptc.wvs.common.ui.Publisher.EPM, null, 0);

  }

  }

  }

  }

Hope it helps !!!

Thanks

Shreyas

1-Visitor
June 29, 2015

Morning  Shreyas Atre and thanks for the speedy reply!

Just a couple quick questions as I have not edited many workflows before:

  • So this will republish the file in question and pick up the state changes in the viewable?
  • To insert this do I just create a new "Expression" and copy and paste your code in?
  • When I do this and click "Check Syntax" I get 8 errors, is this correct?

Checking Syntax...

D:\ptc\WC\Windchill\temp\WfExpression_Administrator.java:33: illegal start of expression

public static void publishReleaseDocument(PromotionNotice primaryBusinessObject) throws WTException {

^

D:\ptc\WC\Windchill\temp\WfExpression_Administrator.java:33: illegal start of expression

public static void publishReleaseDocument(PromotionNotice primaryBusinessObject) throws WTException {

       ^

D:\ptc\WC\Windchill\temp\WfExpression_Administrator.java:33: ';' expected

public static void publishReleaseDocument(PromotionNotice primaryBusinessObject) throws WTException {

             ^

D:\ptc\WC\Windchill\temp\WfExpression_Administrator.java:33: ')' expected

public static void publishReleaseDocument(PromotionNotice primaryBusinessObject) throws WTException {

                                                         ^

D:\ptc\WC\Windchill\temp\WfExpression_Administrator.java:33: illegal start of expression

public static void publishReleaseDocument(PromotionNotice primaryBusinessObject) throws WTException {

                                                                               ^

D:\ptc\WC\Windchill\temp\WfExpression_Administrator.java:33: ';' expected

public static void publishReleaseDocument(PromotionNotice primaryBusinessObject) throws WTException {

                                                                                ^

D:\ptc\WC\Windchill\temp\WfExpression_Administrator.java:33: not a statement

public static void publishReleaseDocument(PromotionNotice primaryBusinessObject) throws WTException {

                                                                                        ^

D:\ptc\WC\Windchill\temp\WfExpression_Administrator.java:33: ';' expected

public static void publishReleaseDocument(PromotionNotice primaryBusinessObject) throws WTException {

                                                                                                   ^

8 errors

Syntax check complete.

Many thanks,

Mike

metherington1-VisitorAuthorAnswer
1-Visitor
July 1, 2015

Issue was resolved by setting republishonepmdocumentchange = true

 

xconfmanager -p -t D:\PTC\WC\Windchill\codebase\wvs.properties -s "publish.republishonepmdocumentchange=true"

 

Please see PTC CS115536 for rough details (Ignore prevent check in section)