Skip to main content
22-Sapphire I
March 16, 2017
Solved

workflow expression code - count number of affected objects

  • March 16, 2017
  • 6 replies
  • 3145 views

Don't ask why but I'm in need of code that can be applied in a workflow expression robot that counts the number of affected objects on a promotion request (technically the "promotion targets.").  Need to branch the workflow if above a certain number.

Getting stuck trying to make it work - would appreciate any suggestions.

thanks in advance

Best answer by PreetiGupta

Hi Mike,

See if this one works.

     wt.fc.QueryResult result = wt.maturity.MaturityHelper.service.getPromotionTargets((wt.maturity.PromotionNotice)primaryBusinessObject));

             int numberOfTarget=result.size();

thanks.

6 replies

18-Opal
March 17, 2017

Mike,

It's been a while but I'm still doing some Windchill development work.

Assuming the Promotion Request is the workflow's PBO, this should get you what you want:

int numberOfTargets = wt.maturity.MaturityHelper.service.getPromotionTargets((wt.maturity.PromotionNotice)primaryBusinessObject).size();

David Graham

1-Visitor
March 17, 2017

not work for me

exeption

18-Opal
March 17, 2017

‌What version of Windchill are you on?