<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How can Get a Workflow Process Template with name and ID information in Windchill Customization</title>
    <link>https://www.ptcusercommunity.com/t5/Windchill-Customization/How-can-Get-a-Workflow-Process-Template-with-name-and-ID/m-p/961985#M8372</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://www.ptcusercommunity.com/t5/user/viewprofilepage/user-id/738918"&gt;Emrec@n&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Before the save, set the type reference&lt;/P&gt;
&lt;LI-CODE lang="java"&gt;newPromotionNotice.setTypeDefinitionReference(TypedUtilityServiceHelper.service.getTypeDefinitionReference("wt.maturity.PromotionNotice|MySubtypeFullInternalName"));
newPromotionNotice = MaturityHelper.service.savePromotionNotice(newPromotionNotice);&lt;/LI-CODE&gt;
&lt;P&gt;PetrH&lt;/P&gt;</description>
    <pubDate>Thu, 18 Jul 2024 08:23:17 GMT</pubDate>
    <dc:creator>HelesicPetr</dc:creator>
    <dc:date>2024-07-18T08:23:17Z</dc:date>
    <item>
      <title>How can Get a Workflow Process Template with name and ID information</title>
      <link>https://www.ptcusercommunity.com/t5/Windchill-Customization/How-can-Get-a-Workflow-Process-Template-with-name-and-ID/m-p/961961#M8367</link>
      <description>&lt;P&gt;Version: Windchill 12.1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to automatically create a Promotion Request for the documents reviewed within the Change Review. I have achieved this with the code shared below. However, since I have not defined any workflow process in the Promotion Notice, no workflow starts. For this, I reached the method shared below. However, I cannot figure out how to obtain the WfProcessTemplate. I have the name and ID of this template, but I couldn't retrieve the template using them.&lt;/P&gt;&lt;P&gt;Code for creating the Promotion Request:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;wt.pom.Transaction trx = new wt.pom.Transaction();&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;wt.change2.WTChangeReview changeReview = (wt.change2.WTChangeReview) primaryBusinessObject;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;// Retrieve the container from the ChangeReview object&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;wt.inf.container.WTContainer container = changeReview.getContainer();&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;wt.inf.container.WTContainerRef containerRef = wt.inf.container.WTContainerRef.newWTContainerRef(container);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;// Retrieve the affected documents from the ChangeReview object&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;wt.fc.QueryResult queryResult = wt.change2.ChangeHelper2.service.getChangeables(changeReview);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;wt.fc.collections.WTSet set = new wt.fc.collections.WTHashSet();&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;while (queryResult.hasMoreElements()) {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; wt.doc.WTDocument document = (wt.doc.WTDocument) queryResult.nextElement();&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; set.add(document); // Add WTDocument objects to the collection&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;try {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; trx.start();&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; wt.maturity.MaturityBaseline maturityBaseline = wt.maturity.MaturityBaseline.newMaturityBaseline();&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; maturityBaseline.setContainerReference(containerRef);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; maturityBaseline = (wt.maturity.MaturityBaseline)wt.fc.PersistenceHelper.manager.save(maturityBaseline);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; wt.maturity.PromotionNotice pn = wt.maturity.PromotionNotice.newPromotionNotice("Custom_Promotion_Request");&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; pn.setPromotionDate(new java.sql.Timestamp(System.currentTimeMillis()));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; pn.setContainer(container);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; pn.setContainerReference(containerRef);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; pn.setMaturityState(wt.lifecycle.State.toState("RELEASED"));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; pn.setDescription("theDescription");&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; pn.setConfiguration(maturityBaseline);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; wt.vc.baseline.BaselineHelper.service.addToBaseline(set, pn.getConfiguration());&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; pn = wt.maturity.MaturityHelper.service.savePromotionNotice(pn);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; wt.maturity.MaturityHelper.service.savePromotionTargets(pn, set);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; trx.commit();&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; trx = null;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;} finally {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; if (trx != null) {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; trx.rollback();&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Code for starting the Promotion Notice with a process:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;wt.maturity.MaturityService.startPromotionProcess(PromotionNotice, WfProcessTemplate)&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jul 2024 07:23:24 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Windchill-Customization/How-can-Get-a-Workflow-Process-Template-with-name-and-ID/m-p/961961#M8367</guid>
      <dc:creator>Emrec@n</dc:creator>
      <dc:date>2024-07-18T07:23:24Z</dc:date>
    </item>
    <item>
      <title>Re: How can Get a Workflow Process Template with name and ID information</title>
      <link>https://www.ptcusercommunity.com/t5/Windchill-Customization/How-can-Get-a-Workflow-Process-Template-with-name-and-ID/m-p/961970#M8369</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://www.ptcusercommunity.com/t5/user/viewprofilepage/user-id/738918"&gt;Emrec@n&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have one suggestion.&lt;/P&gt;
&lt;P&gt;Create new subtype of your promotion request, define specific new lifecycle&amp;nbsp;&lt;/P&gt;
&lt;P&gt;and assignee a workflow to first state of the lifecycle.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Create the subtype by your code and also do not&amp;nbsp; forget to set the subtype as &lt;STRONG&gt;instantiable&lt;/STRONG&gt; to &lt;STRONG&gt;no&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Users won't create it but you can by the code.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the PR is created the workflow will be started based on the lifecycle.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PetrH&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jul 2024 07:28:44 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Windchill-Customization/How-can-Get-a-Workflow-Process-Template-with-name-and-ID/m-p/961970#M8369</guid>
      <dc:creator>HelesicPetr</dc:creator>
      <dc:date>2024-07-18T07:28:44Z</dc:date>
    </item>
    <item>
      <title>Re: How can Get a Workflow Process Template with name and ID information</title>
      <link>https://www.ptcusercommunity.com/t5/Windchill-Customization/How-can-Get-a-Workflow-Process-Template-with-name-and-ID/m-p/961977#M8371</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://www.ptcusercommunity.com/t5/user/viewprofilepage/user-id/241117"&gt;@HelesicPetr&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This idea sounds good. However, how should I define the subtype I created in the code, and what changes do I need to make in the code? For example, how should I modify the above code for a promotion subtype named XXX?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example, like this?&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;pn = wt.maturity.MaturityHelper.service.savePromotionNotice|XXX(pn);&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jul 2024 07:55:03 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Windchill-Customization/How-can-Get-a-Workflow-Process-Template-with-name-and-ID/m-p/961977#M8371</guid>
      <dc:creator>Emrec@n</dc:creator>
      <dc:date>2024-07-18T07:55:03Z</dc:date>
    </item>
    <item>
      <title>Re: How can Get a Workflow Process Template with name and ID information</title>
      <link>https://www.ptcusercommunity.com/t5/Windchill-Customization/How-can-Get-a-Workflow-Process-Template-with-name-and-ID/m-p/961985#M8372</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://www.ptcusercommunity.com/t5/user/viewprofilepage/user-id/738918"&gt;Emrec@n&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Before the save, set the type reference&lt;/P&gt;
&lt;LI-CODE lang="java"&gt;newPromotionNotice.setTypeDefinitionReference(TypedUtilityServiceHelper.service.getTypeDefinitionReference("wt.maturity.PromotionNotice|MySubtypeFullInternalName"));
newPromotionNotice = MaturityHelper.service.savePromotionNotice(newPromotionNotice);&lt;/LI-CODE&gt;
&lt;P&gt;PetrH&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jul 2024 08:23:17 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Windchill-Customization/How-can-Get-a-Workflow-Process-Template-with-name-and-ID/m-p/961985#M8372</guid>
      <dc:creator>HelesicPetr</dc:creator>
      <dc:date>2024-07-18T08:23:17Z</dc:date>
    </item>
    <item>
      <title>Re: How can Get a Workflow Process Template with name and ID information</title>
      <link>https://www.ptcusercommunity.com/t5/Windchill-Customization/How-can-Get-a-Workflow-Process-Template-with-name-and-ID/m-p/962001#M8373</link>
      <description>&lt;P&gt;&lt;a href="https://www.ptcusercommunity.com/t5/user/viewprofilepage/user-id/241117"&gt;@HelesicPetr&lt;/a&gt;&amp;nbsp;,&amp;nbsp;I think there's an error in the method. When I do a Check Syntax, I get an error.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;newPromotionNotice.setTypeDefinitionReference(&lt;STRONG&gt;TypedUtilityServiceHelper.service.getTypeDefinitionReference&lt;/STRONG&gt;("wt.maturity.PromotionNotice|MySubtypeFullInternalName"));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There is a situation like the following in the JavaDoc.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;com.ptc.core.meta.type.mgmt.server.impl.service.StandardTypedUtilityService.getTypeDefinitionReference(java.lang.String fullname)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jul 2024 09:39:13 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Windchill-Customization/How-can-Get-a-Workflow-Process-Template-with-name-and-ID/m-p/962001#M8373</guid>
      <dc:creator>Emrec@n</dc:creator>
      <dc:date>2024-07-18T09:39:13Z</dc:date>
    </item>
    <item>
      <title>Re: How can Get a Workflow Process Template with name and ID information</title>
      <link>https://www.ptcusercommunity.com/t5/Windchill-Customization/How-can-Get-a-Workflow-Process-Template-with-name-and-ID/m-p/962005#M8374</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://www.ptcusercommunity.com/t5/user/viewprofilepage/user-id/738918"&gt;Emrec@n&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There is not a syntax error.&lt;/P&gt;
&lt;P&gt;I use it all the time&lt;/P&gt;
&lt;P&gt;Check that you use correct class&lt;/P&gt;
&lt;DIV&gt;
&lt;PRE&gt;&lt;SPAN&gt;wt.type.&lt;/SPAN&gt;TypedUtilityServiceHelper&lt;/PRE&gt;
&lt;P&gt;You have to use full package definition of the class if you use the code in the workflow directly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;I use IDE to write a code so I use import function to import the package.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PS&amp;gt; it is useful to share the error.&lt;/P&gt;
&lt;P&gt;PetrH&lt;/P&gt;
&lt;/DIV&gt;</description>
      <pubDate>Thu, 18 Jul 2024 09:57:47 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Windchill-Customization/How-can-Get-a-Workflow-Process-Template-with-name-and-ID/m-p/962005#M8374</guid>
      <dc:creator>HelesicPetr</dc:creator>
      <dc:date>2024-07-18T09:57:47Z</dc:date>
    </item>
    <item>
      <title>Re: How can Get a Workflow Process Template with name and ID information</title>
      <link>https://www.ptcusercommunity.com/t5/Windchill-Customization/How-can-Get-a-Workflow-Process-Template-with-name-and-ID/m-p/962012#M8375</link>
      <description>&lt;DIV class=""&gt;&lt;DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;P&gt;&lt;a href="https://www.ptcusercommunity.com/t5/user/viewprofilepage/user-id/241117"&gt;@HelesicPetr&lt;/a&gt;&amp;nbsp; Great, this worked, thank you very much.&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 18 Jul 2024 10:29:42 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Windchill-Customization/How-can-Get-a-Workflow-Process-Template-with-name-and-ID/m-p/962012#M8375</guid>
      <dc:creator>Emrec@n</dc:creator>
      <dc:date>2024-07-18T10:29:42Z</dc:date>
    </item>
    <item>
      <title>Re: How can Get a Workflow Process Template with name and ID information</title>
      <link>https://www.ptcusercommunity.com/t5/Windchill-Customization/How-can-Get-a-Workflow-Process-Template-with-name-and-ID/m-p/964784#M8476</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;You can do as below. As the Workflow of the Promotion is configurable through preference, it is a good way to check the required preference.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;//Get the Workflow Template. This will get it through preference set in the container.&lt;/P&gt;&lt;P&gt;WfProcessTemplate promotionWfProcessTemplate = PromotionRequestHelper.getWorkflowTemplate(containerRef, State.toState("OPEN"), null);&lt;/P&gt;&lt;P&gt;//Start the Process.&lt;BR /&gt;MaturityHelper.service.startPromotionProcess(promotionNotice, promotionWfProcessTemplate);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;NOTE: This will be a post transaction call.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Thiaga&lt;/P&gt;</description>
      <pubDate>Fri, 02 Aug 2024 09:40:35 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Windchill-Customization/How-can-Get-a-Workflow-Process-Template-with-name-and-ID/m-p/964784#M8476</guid>
      <dc:creator>tm-4</dc:creator>
      <dc:date>2024-08-02T09:40:35Z</dc:date>
    </item>
  </channel>
</rss>

