Skip to main content
1-Visitor
March 2, 2017
Question

Hello all, Is there any way to get active promotion requests on a part/document?

  • March 2, 2017
  • 1 reply
  • 2611 views

Given a specific part, we would like to get linked promotion request and/or change notice that is still active.

1 reply

1-Visitor
March 2, 2017

For changes, I used - http://support.ptc.com/cs/wncdoc/102/wcapi/wt/change2/ChangeService2.html#getLatestChangeRequest(wt.change2.ChangeableIf…

there are similar methods for changeissue and changeorder in ChangeHelper2

For promotions, I used WTCollection pNotices =  MaturityHelper.service.getPromotionNotices(wCollect); wCollect is a part collection

1-Visitor
March 21, 2017

Hi ,

For to get active Promotion Notice from Affected object we can use following logic

             

              WTObject returnObj = null;

       wt.maturity.StandardMaturityService p=new wt.maturity.StandardMaturityService();

       WTArrayList arr=new WTArrayList();

       arr.add(wtPart);

       WTCollection pn1=p.getPromotionNotices(arr);

       PromotionNotice not=null;

       if(!(pn1.isEmpty()))

       {

              for (Object nott: pn1)

              {

                     ObjectReference or=(ObjectReference) nott;

                     Persistable per=or.getObject();

                     if(per instanceof PromotionNotice)

                     {

                           not=(PromotionNotice) per;

                           System.out.println("Notices"+not);

                                 

                           LifeCycleState state=not.getState();

                           String s=state.toString();

                          

                           if(s.equalsIgnoreCase("UNDERREVIEW") )

                           {

                                 

                                  returnObj = not;

                                 

                           }

                          

                     }

              }

       }

       return returnObj;

Similarly if we want Change Notice from WTPart/WTDocument directly do you know any API?

17-Peridot
February 14, 2022
hpali, thank you for the code provided. It worked for us