Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X
I just did something similar, although it was to find a Promotion Notice from it's number and assign it to Workflow Variable. Below is the code. I did this on the Complete transition after a user entered a number in to a task variable. Just change the class from wt.maturity.PromotionNotice to your class and update the search criteria and you should be good.
wt.query.QuerySpec qs = new wt.query.QuerySpec(wt.maturity.PromotionNotice.class);
qs.appendWhere(new wt.query.SearchCondition(wt.maturity.PromotionNotice.class,
wt.maturity.PromotionNotice.NUMBER,
wt.query.SearchCondition.EQUAL,pnNumber),new int[]{0});
wt.fc.QueryResult qr = wt.fc.PersistenceHelper.manager.find(qs);
while (qr.hasMoreElements())
{
wt.fc.WTObject obj = (wt.fc.WTObject) qr.nextElement();
if (obj instanceof wt.maturity.PromotionNotice){
promotionNotice = (wt.maturity.PromotionNotice) obj;
}
}