cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

The PTC Community email address has changed to community-mailer@ptc.com. Learn more.

Change Task Numbering

Change Task Numbering

Idea is to have Change Task Numbers generated based on Change Notice Numbers.  Example: if Change Notice Number is ECN1234 then associated Change Tasks would be ECN1234-01, ECN-1234-02 etc.  Idea is to make this an available Numbering (by preference or algorithm), not to force everyone into using it.

Benefit is an immediate visual relationship

6 Comments
OliverDroop
12-Amethyst

This is a nice idea which would be easily to solve. If you like to implement on your own you would need to register your own class for the number generator in the OIR for the change activites.

This class would need to get associated ECN and increment the next available sequence.

Drawback is deleting tasks which should not occur to often. I would guess I would implement the squence index on the owning ECN and just pick this along with the number you need anyway.

This should be a slick implementation. Everytime a CA gets created you increment by 1.

kpritchard
4-Participant

Any comments on the timing of presistence of the CN and when the CN Number is available relative to when the number is gerenated for the CA?

Ideas on API's to use? 

MikeLockwood
22-Sapphire I

This method creates a Change Activity (aka Change Task) from the Change Notice (aka Change Order) workflow.  Use an expression robot for all code or call from an expression robot.  It Numbers the CT to match the CN root Number.

    /**
     * This method creates a new CT (ChangeActivity) attached to the changeOrder (CN), using the root Number of the CN.<Br>
  * It takes the cTType and appends to the end of the CT Number.<Br>
     * @param changeOrder The Change order that the CT will be attached to
     * @param cTType The type of request, appended to the end.
     * @return A change Activity so that the team as well as items can be manipulated off of.
     */
    public static WTChangeActivity2 createCT(WTChangeOrder2 changeOrder, String cTType)  {
        wt.pom.Transaction transaction = null;
        WTChangeActivity2 changeActivityReturn = null;
        ChangeActivityIfc changeActivityIfc=null;
        try {
            // Instantiate the Change Task
            wt.change2.WTChangeActivity2 changeActivity = wt.change2.WTChangeActivity2.newWTChangeActivity2();
            //Determine # of CTs of CTType
            Integer cAInt = 1;
            QueryResult changeActivityQR = ChangeHelper2.service.getChangeActivities((ChangeOrderIfc) changeOrder);
            while(changeActivityQR.hasMoreElements()) {
                WTChangeActivity2 cA = (WTChangeActivity2) changeActivityQR.nextElement();
                String cANumber = cA.getNumber();
                if(cANumber.contains(cTType)&&cA.isLatest()&&cA.isLatestIteration()) {
                    cAInt += 1;
                }
            }

            // Set CT Number based on CN Number
            changeActivity.setNumber("CT" + changeOrder.getNumber().substring(2) + "-"+ cTType + "-" + cAInt);
            // Set CT Name based on CN Name
            changeActivity.setName(changeOrder.getName());
            // Set CT Description from CN Description
            changeActivity.setDescription(changeOrder.getDescription());
            // Set CT Container from CN Container
            changeActivity.setContainer(changeOrder.getContainer());
            // Set CT NeedDate from CR NeedDate
            if(changeOrder.getNeedDate() == null) {
                changeActivity.setNeedDate(new java.sql.Timestamp(System.currentTimeMillis()));
            } else {
                changeActivity.setNeedDate(changeOrder.getNeedDate());
            }
            //Start transaction to save Change Notice and Change Task with correct relationships
            transaction = new wt.pom.Transaction();
            transaction.start();

            //Persist Change Task
            changeActivityIfc = ChangeHelper2.service.saveChangeActivity(changeOrder,changeActivity);
            QueryResult changeRequestQR = wt.change2.ChangeHelper2.service.getChangeRequest(changeOrder);
            //Set CT Affected Objects from CR Affected Objects
            QueryResult changeRequestChangeables = wt.change2.ChangeHelper2.service.getChangeables((WTChangeRequest2)changeRequestQR.nextElement());
            Vector<AffectedActivityData> aadVector = new Vector<AffectedActivityData>();
                while(changeRequestChangeables.hasMoreElements()){
                    Changeable2 changeRequestChangeablesNE = (Changeable2) changeRequestChangeables.nextElement();
                    aadVector.add(AffectedActivityData.newAffectedActivityData(changeRequestChangeablesNE,(WTChangeActivity2) changeActivityIfc));
                }
            ChangeHelper2.service.saveAffectedActivityData(aadVector);
            transaction.commit();
            transaction = null;
            changeActivityReturn = (WTChangeActivity2) changeActivityIfc;
            return changeActivityReturn;
        } catch(WTPropertyVetoException e) {
            e.printStackTrace();
            LOGGER.error("Error while creating CT: " + e);
        } catch(ChangeException2 e) {
            e.printStackTrace();
            LOGGER.error("Error while creating CT: " + e);
        } catch(WTException e) {
            e.printStackTrace();
            LOGGER.error("Error while creating CT: " + e);
        } finally {
            if(transaction != null)  {
                transaction.rollback();
                LOGGER.debug("transaction.rollback");
                return null;
            }
        }
        return changeActivityReturn;

kpritchard
4-Participant

Thanks Mike - I am looking for the Numbering behaviour to hold when creating a Change Task/Activity in all cases... Wizard Step, Editing the Change notice to  add Tasks and Automatically created CN's (from CR Workflow).

That being said, I'm wondering if you can elaborate on the expression Robot (or called from Expression robot) use case(s).

PTCModerator
Emeritus
Status changed to: Under Consideration
 
nsamardzija
10-Marble
Status changed to: Alternate Solution

Thank you for the idea. Users have suggested reasonable workarounds/approaches to implement this behavior in the comments section of this idea. Today, there are no plans to implement this functionality out-of-the-box.