Skip to main content
17-Peridot
February 19, 2025
Solved

Workflow expression "cannot find symbol" of compiled custom class

  • February 19, 2025
  • 1 reply
  • 563 views

Version: Windchill 13.0

 

Use Case: I wrote/compiled some code to collect and send to a messaging queue a part BOM. Part of this code has two custom classes (BOM, BOMLines). The return of my method is a List but the workflow expression says it "cannot find symbol" for my BOM class.


Description:

In the workflow expression I have:

 

java.util.List<ext.comp.BOM> myBOM = ext.comp.getBOMSfromECN(cn);
ext.comp.Messages.sendToERP("BOM from ECN: " + myBom.toString());		

 

Check syntax in the workflow doesn't like the ext.comp.BOM...

 

WfExpression_88956210.java:72: error: cannot find symbol
 java.util.List<ext.ursa.BOM> myBOM = ext.ursa.getBOMSfromECN(cn);
 ^

 

 

On the server I have a BOM.java and BOM.class. Originally I had both of my custom classes in my main code but a compilation error said these would have to exist as standalone .java, so they do. 

 

How can I use my custom class in a workflow expression? 

 

package ext.comp;

import java.util.*;

public class BOM {
 private List<BOMLine> lines;
 private String parentPN;
 private String parentRev;

 public BOM(List<BOMLine> lines, String parentPN, String parentRev) {
 this.lines = lines;
 this.parentPN = parentPN;
 this.parentRev = parentRev;
 }
 
 public void setLines(List<BOMLine> children){
 this.lines = children;
 }
}

 

 

Best answer by Dobi

@joe_morton  I did yes... what turned out to be the issue was more basic (Java basic). 

 

The method was not static so I needed to invoke it differently. First create a new instance and then invoke the method:

 

ext.comp.getBOMS gb = new ext.comp.getBOMS();
java.util.List<ext.comp.BOM> myBOM = gb.getBOMSfromECN(cn);

 

Alternatively, if getBOMSFromECN is a static method, then I can invoke it like I had it:

 

java.util.List<ext.comp.BOM> myBOM = ext.comp.getBOMSfromECN(cn);

 

PTC Tech Support was actually support prompt and extremely helpful in getting this sorted out.

1 reply

joe_morton
18-Opal
18-Opal
February 24, 2025
Dobi17-PeridotAuthorAnswer
17-Peridot
February 24, 2025

@joe_morton  I did yes... what turned out to be the issue was more basic (Java basic). 

 

The method was not static so I needed to invoke it differently. First create a new instance and then invoke the method:

 

ext.comp.getBOMS gb = new ext.comp.getBOMS();
java.util.List<ext.comp.BOM> myBOM = gb.getBOMSfromECN(cn);

 

Alternatively, if getBOMSFromECN is a static method, then I can invoke it like I had it:

 

java.util.List<ext.comp.BOM> myBOM = ext.comp.getBOMSfromECN(cn);

 

PTC Tech Support was actually support prompt and extremely helpful in getting this sorted out.