Quantcast
Channel: PTC Community: Message List - Windchill
Viewing all articles
Browse latest Browse all 8876

Re: How can I show the value of a global attribute on a Change Request on a Change notice?

$
0
0

Using an workflow Expression Robot (expression tab):

 

try {

            com.ptc.core.lwc.server.LWCNormalizedObject obj = new com.ptc.core.lwc.server.LWCNormalizedObject((wt.fc.Persistable)primaryBusinessObject,null,null,null);

            obj.load("Reason_For_Change");

            Boolean flag=false;

            if (obj.get("Reason_For_Change")==null || obj.get("Reason_For_Change").toString().equalsIgnoreCase("") ){

                wt.fc.QueryResult fc= wt.change2.ChangeHelper2.service.getChangeRequest((wt.change2.ChangeOrderIfc)primaryBusinessObject);

                while (fc.hasMoreElements()) {

                    wt.change2.WTChangeRequest2 object = (wt.change2.WTChangeRequest2) fc.nextElement();

                    com.ptc.core.lwc.server.LWCNormalizedObject objcr = new com.ptc.core.lwc.server.LWCNormalizedObject((wt.fc.Persistable)object,null,null,null);

                    objcr.load("Reason_For_Change");

                    Object ncr= objcr.get("Reason_For_Change");

                    if (ncr !=null && !ncr.toString().equalsIgnoreCase("")) {

                        obj.set("Reason_For_Change",ncr.toString());

                        obj.apply();

                        flag=true;

                    }

                }

            }

     

            if(flag) {

                primaryBusinessObject=(wt.change2.WTChangeOrder2) wt.fc.PersistenceHelper.manager.modify((wt.fc.Persistable)primaryBusinessObject);

            }           

           

        } catch (wt.util.WTException e) {

            // TODO Auto-generated catch block

            e.printStackTrace();

        }

 

We have multiples of the exp robots in a row as there is a limit to the number of code characters.  Replace "Reason_For_Change" above with your attribute then test by creating a change notice and propagating.


Viewing all articles
Browse latest Browse all 8876

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>