<?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 to create a baseline in a promotion request workflow? in Windchill Customization</title>
    <link>https://www.ptcusercommunity.com/t5/Windchill-Customization/How-to-create-a-baseline-in-a-promotion-request-workflow/m-p/974043#M8757</link>
    <description>&lt;P&gt;&lt;a href="https://www.ptcusercommunity.com/t5/user/viewprofilepage/user-id/773265"&gt;@Loic_Badoual&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I looked at your code.&amp;nbsp; There's more than setting the container reference that's wrong.&lt;/P&gt;
&lt;P&gt;As is this code should not compile.&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;You are using variables that are not defined.&lt;/LI&gt;
&lt;LI&gt;You are calling methods from objects that do not have access to the called method.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is it correct to say primaryBusinessObject is the OOTB workflow variable?&amp;nbsp; For now, I'll assume yes to that question.&lt;/P&gt;
&lt;P&gt;primaryBusinessObject is a WTObject.&amp;nbsp; There is no method getContainerReference() for a WTObject.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What you have now is this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;baselineObj.setContainerReference((WTPart)primaryBusinessObject.getContainerReference()); &lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There are four problems with this line ofcode.&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;primaryBusinessObject is not defined.&lt;/LI&gt;
&lt;LI&gt;primaryBusinessObject is a WTObject.&amp;nbsp; There is no getContinerReference() method for object WTObject.&lt;/LI&gt;
&lt;LI&gt;Even if item 2 was not a problem, you are still casting the container reference returned from the getContainerReference() method to a WTPart.&amp;nbsp; This would throw a cast exception as a container ref cannot be cast to a WTPart.&lt;/LI&gt;
&lt;LI&gt;the method setContainerReference method requires, well, a container reference not a WTPart. You are casting a container ref to a WTPart and then passing that WTPart to te setContainerReference method.&amp;nbsp; That's not going to fly.&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Code should be as shown below.&lt;/P&gt;
&lt;P&gt;Note, I simply went straight for the WTPart that you are passing to your method to get the container reference.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;baselineObj.setContainerReference(part.getContainerReference()); &lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Once you get past that part of your code the line of code below will be a problem.&lt;/P&gt;
&lt;P&gt;Your method contains the following:&lt;/P&gt;
&lt;P&gt;WTContainerRef containerRef = WTContainerRef.newWTContainerRef(&lt;STRONG&gt;containerRef&lt;/STRONG&gt;);&lt;/P&gt;
&lt;P&gt;However, the variable &lt;STRONG&gt;containerRef&lt;/STRONG&gt; is never defined. And if it were why use it to create another WTContainerRef.&lt;/P&gt;
&lt;P&gt;Why not use the same containerRef object in multiple places.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also,&amp;nbsp;public static void createBaseline(WTPart part,&lt;STRONG&gt;String ContainerName&lt;/STRONG&gt;) throws Exception {&lt;/P&gt;
&lt;P&gt;String ContainerName is never used in your method.&amp;nbsp; Why have it?&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Is String ContainerName the name of the container for the Baseline, which is not the same as the WTPart's container?&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;BTW, in Java, the convention to naming method arguments is that they always start with lowercase.&amp;nbsp; Not critical of course but that's the convention. So, &lt;STRONG&gt;String ContainerName&lt;/STRONG&gt; would be &lt;STRONG&gt;String containerName. But again, your method never uses it so why not remove this argument?&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If your Baseline folder is in the same container as the WTPart (maybe it is, but maybe it's not). The following method should work for you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;    public static void createBaseline(WTPart part) throws Exception {
        System.out.println("Start....");
        ManagedBaseline baselineObj = ManagedBaseline.newManagedBaseline();
        baselineObj.setName("test");
        baselineObj.setDescription("this is a test baseline");

        WTContainerRef containerRef = WTContainerRef.newWTContainerRef(part.getContainerReference());
        baselineObj.setContainerReference(containerRef);

        Folder folder = FolderHelper.service.getFolder("/Default/Baseline", containerRef);
        FolderHelper.assignLocation((FolderEntry) baselineObj, folder);

        baselineObj = (ManagedBaseline) wt.fc.PersistenceHelper.manager.save(baselineObj);
        System.out.println("===&amp;gt; myManagedBaseline " + baselineObj);
    }&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;David&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 26 Sep 2024 15:34:18 GMT</pubDate>
    <dc:creator>d_graham</dc:creator>
    <dc:date>2024-09-26T15:34:18Z</dc:date>
    <item>
      <title>How to create a baseline in a promotion request workflow?</title>
      <link>https://www.ptcusercommunity.com/t5/Windchill-Customization/How-to-create-a-baseline-in-a-promotion-request-workflow/m-p/973975#M8756</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Version: Windchill 12.0.2.18&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;We are looking to create a Managed Baseline in our promotion request workflow for all mechanical assembly with the name &amp;nbsp;*-01-g.asm&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I have found the &lt;A href="https://www.ptc.com/en/support/article/CS371627?source=search" target="_blank" rel="noopener"&gt;Article - CS371627 - How to create a baseline in a (promotion request) workflow?&lt;/A&gt; and the &lt;A href="https://www.ptc.com/en/support/article/CS25967" target="_blank" rel="noopener"&gt;Article - CS25967 - How to programmatically create a managed baseline in Windchill PDMLink&lt;/A&gt; which give some ideas, but I am having some difficulty going deeper into the development.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The small step I have already succeed is the following :&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Add an "Execute Expression" robot after the "Set State Approved" method Robot and the Notify By E-mail robot :&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Loic_Badoual_0-1727354644368.png" style="width: 400px;"&gt;&lt;img src="https://www.ptcusercommunity.com/t5/image/serverpage/image-id/111270i9A157BC1BC2E8B25/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Loic_Badoual_0-1727354644368.png" alt="Loic_Badoual_0-1727354644368.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;The code to execute to the expression call a custom class :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;ext.sce.workflow.CreateBaseline.createBaseline(baselineName);&lt;/LI-CODE&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;The content of the class is the following :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;package ext.sce.workflow;

import wt.vc.baseline.ManagedBaseline;
import wt.util.WTException;
import wt.util.WTPropertyVetoException;
import wt.fc.PersistenceHelper;


public class CreateBaseline {
	
    public static void createBaseline(String name) throws WTException {
        try {
            System.out.println("Start....");
            ManagedBaseline myManagedBaseline = ManagedBaseline.newManagedBaseline();
            myManagedBaseline.setName("test");
            myManagedBaseline.setDescription("this is a test baseline");
            myManagedBaseline = (ManagedBaseline) PersistenceHelper.manager.save(myManagedBaseline);
            System.out.println("===&amp;gt; myManagedBaseline " + myManagedBaseline);
        } catch (WTPropertyVetoException e) {
            e.printStackTrace();
        } catch (WTException e) {
            e.printStackTrace();
        }
    }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When a CAD assembly is approved, a &lt;SPAN&gt;Managed Baseline&lt;/SPAN&gt; is created in the Default folder of the Site.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Loic_Badoual_1-1727354993789.png" style="width: 400px;"&gt;&lt;img src="https://www.ptcusercommunity.com/t5/image/serverpage/image-id/111273i9F7F7579A942B633/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Loic_Badoual_1-1727354993789.png" alt="Loic_Badoual_1-1727354993789.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now the expectation is to&amp;nbsp; &lt;SPAN&gt;create the ManagedBaseline&amp;nbsp;in the folder of the primary object and&amp;nbsp; add the collection of&amp;nbsp;&lt;/SPAN&gt;Baselineable&lt;SPAN&gt; CAD model to the baseline.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;If I follow the example in the CS25967 in order to create the ManagedBaseline in the correct folder :&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;package ext.sce.workflow;

import wt.vc.baseline.ManagedBaseline;
import wt.part.WTPart;
import wt.fc.WTObject;
import wt.folder.Folder;
import wt.folder.FolderEntry;
import wt.folder.FolderHelper;
import wt.inf.container.WTContainer;
import wt.inf.container.WTContainerRef;

public class CreateBaseline_1 {

public static void createBaseline(WTPart part,String ContainerName) throws Exception {
System.out.println("Start....");
ManagedBaseline baselineObj = ManagedBaseline.newManagedBaseline(); 
baselineObj.setName("test"); 
baselineObj.setDescription("this is a test baseline"); 
baselineObj.setContainerReference((WTPart)primaryBusinessObject.getContainerReference()); 

WTContainerRef containerRef = WTContainerRef.newWTContainerRef(containerRef);
Folder folder = FolderHelper.service.getFolder("/Default/Baseline", containerRef);
FolderHelper.assignLocation((FolderEntry)baselineObj, folder);

baselineObj=(ManagedBaseline)wt.fc.PersistenceHelper.manager.save(baselineObj);
System.out.println("===&amp;gt; myManagedBaseline " +baselineObj);
}
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;There is an issue with the setContainerReference&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any idea how to solve this ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Loïc&lt;/P&gt;</description>
      <pubDate>Thu, 26 Sep 2024 13:02:32 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Windchill-Customization/How-to-create-a-baseline-in-a-promotion-request-workflow/m-p/973975#M8756</guid>
      <dc:creator>Loic_Badoual</dc:creator>
      <dc:date>2024-09-26T13:02:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a baseline in a promotion request workflow?</title>
      <link>https://www.ptcusercommunity.com/t5/Windchill-Customization/How-to-create-a-baseline-in-a-promotion-request-workflow/m-p/974043#M8757</link>
      <description>&lt;P&gt;&lt;a href="https://www.ptcusercommunity.com/t5/user/viewprofilepage/user-id/773265"&gt;@Loic_Badoual&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I looked at your code.&amp;nbsp; There's more than setting the container reference that's wrong.&lt;/P&gt;
&lt;P&gt;As is this code should not compile.&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;You are using variables that are not defined.&lt;/LI&gt;
&lt;LI&gt;You are calling methods from objects that do not have access to the called method.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is it correct to say primaryBusinessObject is the OOTB workflow variable?&amp;nbsp; For now, I'll assume yes to that question.&lt;/P&gt;
&lt;P&gt;primaryBusinessObject is a WTObject.&amp;nbsp; There is no method getContainerReference() for a WTObject.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What you have now is this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;baselineObj.setContainerReference((WTPart)primaryBusinessObject.getContainerReference()); &lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There are four problems with this line ofcode.&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;primaryBusinessObject is not defined.&lt;/LI&gt;
&lt;LI&gt;primaryBusinessObject is a WTObject.&amp;nbsp; There is no getContinerReference() method for object WTObject.&lt;/LI&gt;
&lt;LI&gt;Even if item 2 was not a problem, you are still casting the container reference returned from the getContainerReference() method to a WTPart.&amp;nbsp; This would throw a cast exception as a container ref cannot be cast to a WTPart.&lt;/LI&gt;
&lt;LI&gt;the method setContainerReference method requires, well, a container reference not a WTPart. You are casting a container ref to a WTPart and then passing that WTPart to te setContainerReference method.&amp;nbsp; That's not going to fly.&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Code should be as shown below.&lt;/P&gt;
&lt;P&gt;Note, I simply went straight for the WTPart that you are passing to your method to get the container reference.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;baselineObj.setContainerReference(part.getContainerReference()); &lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Once you get past that part of your code the line of code below will be a problem.&lt;/P&gt;
&lt;P&gt;Your method contains the following:&lt;/P&gt;
&lt;P&gt;WTContainerRef containerRef = WTContainerRef.newWTContainerRef(&lt;STRONG&gt;containerRef&lt;/STRONG&gt;);&lt;/P&gt;
&lt;P&gt;However, the variable &lt;STRONG&gt;containerRef&lt;/STRONG&gt; is never defined. And if it were why use it to create another WTContainerRef.&lt;/P&gt;
&lt;P&gt;Why not use the same containerRef object in multiple places.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also,&amp;nbsp;public static void createBaseline(WTPart part,&lt;STRONG&gt;String ContainerName&lt;/STRONG&gt;) throws Exception {&lt;/P&gt;
&lt;P&gt;String ContainerName is never used in your method.&amp;nbsp; Why have it?&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Is String ContainerName the name of the container for the Baseline, which is not the same as the WTPart's container?&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;BTW, in Java, the convention to naming method arguments is that they always start with lowercase.&amp;nbsp; Not critical of course but that's the convention. So, &lt;STRONG&gt;String ContainerName&lt;/STRONG&gt; would be &lt;STRONG&gt;String containerName. But again, your method never uses it so why not remove this argument?&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If your Baseline folder is in the same container as the WTPart (maybe it is, but maybe it's not). The following method should work for you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;    public static void createBaseline(WTPart part) throws Exception {
        System.out.println("Start....");
        ManagedBaseline baselineObj = ManagedBaseline.newManagedBaseline();
        baselineObj.setName("test");
        baselineObj.setDescription("this is a test baseline");

        WTContainerRef containerRef = WTContainerRef.newWTContainerRef(part.getContainerReference());
        baselineObj.setContainerReference(containerRef);

        Folder folder = FolderHelper.service.getFolder("/Default/Baseline", containerRef);
        FolderHelper.assignLocation((FolderEntry) baselineObj, folder);

        baselineObj = (ManagedBaseline) wt.fc.PersistenceHelper.manager.save(baselineObj);
        System.out.println("===&amp;gt; myManagedBaseline " + baselineObj);
    }&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;David&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Sep 2024 15:34:18 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Windchill-Customization/How-to-create-a-baseline-in-a-promotion-request-workflow/m-p/974043#M8757</guid>
      <dc:creator>d_graham</dc:creator>
      <dc:date>2024-09-26T15:34:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a baseline in a promotion request workflow?</title>
      <link>https://www.ptcusercommunity.com/t5/Windchill-Customization/How-to-create-a-baseline-in-a-promotion-request-workflow/m-p/974787#M8781</link>
      <description>&lt;P&gt;&lt;a href="https://www.ptcusercommunity.com/t5/user/viewprofilepage/user-id/121147"&gt;@d_graham&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;Thank you for your time and for the detailed answer.&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;SPAN class=""&gt;&lt;SPAN class=""&gt;It helps me a lot to progress.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;However, I try to launch the method via an "Execute Expression" robot but without success.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;I can't find the solution to assign the value of the WTPart...&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I try several expression like this :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="java"&gt;wt.part.WTPart part = (wt.part.WTPart) primaryBusinessObject;
ext.sce.workflow.CreateBaseline.createBaseline(part);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The Syntax check is complete but when running the workflow,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the error is the following :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;wt.util.WTException: java.lang.ClassCastException: class wt.maturity.PromotionNotice cannot be cast to class wt.part.WTPart (wt.maturity.PromotionNotice and wt.part.WTPart are in unnamed module of loader 'app')&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I also tried another method by creating another robot "Execute Expression" to extract the list of objects related to the promotion request which I know works:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="java"&gt;wt.fc.QueryResult promotables = wt.maturity.MaturityHelper.service.getPromotionTargets((wt.maturity.PromotionNotice)primaryBusinessObject);
promObjList = new ArrayList&amp;lt;String&amp;gt;();

while(promotables.hasMoreElements()){
	wt.fc.WTObject promotable = (wt.fc.WTObject) promotables.nextElement();
	promObjList.add(promotable.getDisplayIdentity());
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;The promObjList is define as a java.util.ArrayList and the content of the value in my example is the following : [Assembly - sc-test-01-g.asm, Q.1]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The syntax check of the following expression give an error: incompatible types: ArrayList cannot be converted to WTPart&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;ext.sce.workflow.CreateBaseline.createBaseline(promObjList);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;I realize that it is not so simple.&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;SPAN class=""&gt;&lt;SPAN class=""&gt;A tip would be welcome!&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;Kind regards, &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;Loïc&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Sep 2024 14:44:51 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Windchill-Customization/How-to-create-a-baseline-in-a-promotion-request-workflow/m-p/974787#M8781</guid>
      <dc:creator>Loic_Badoual</dc:creator>
      <dc:date>2024-09-30T14:44:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a baseline in a promotion request workflow?</title>
      <link>https://www.ptcusercommunity.com/t5/Windchill-Customization/How-to-create-a-baseline-in-a-promotion-request-workflow/m-p/975485#M8793</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://www.ptcusercommunity.com/t5/user/viewprofilepage/user-id/773265"&gt;@Loic_Badoual&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In your case the promaryBusinessObject is the&amp;nbsp;PromotionNotice&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You need to get the target objects&amp;nbsp;getPromotionTargets .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But your code use ArrayList with a String and you probably try to put the ArrayList to the Part type that is not possible.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You need to get the object from the&amp;nbsp;&amp;nbsp;promotables list where the WTPart is return by the&amp;nbsp;getPromotionTargets .&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="java"&gt;while (promotables.hasMoreElements())
{
 Object obj = promotables.nextElement();
  if (obj instanceof WTPart)
   {
     WTPart wtp = (WTPart) obj;
   }
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;in your case you need to just add the full class definition. WTPart = wt.part.WTPart ....&amp;nbsp;PetrH&lt;/P&gt;</description>
      <pubDate>Thu, 03 Oct 2024 08:34:38 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Windchill-Customization/How-to-create-a-baseline-in-a-promotion-request-workflow/m-p/975485#M8793</guid>
      <dc:creator>HelesicPetr</dc:creator>
      <dc:date>2024-10-03T08:34:38Z</dc:date>
    </item>
  </channel>
</rss>

