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

We are happy to announce the new Windchill Customization board! Learn more.

Windchill Workflow Templates - Publish at certain points

metherington
1-Newbie

Windchill Workflow Templates - Publish at certain points

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

1 ACCEPTED SOLUTION

Accepted Solutions

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)

View solution in original post

3 REPLIES 3

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

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

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)

Top Tags