Auto close change task when chance is abandoned/withdrawn.

Hello guys,
I would like to auto close change task when a change(Normal, standard, emergency) is abandoned, withdraw are cancelled. Currently it is asking to close task before abandoning/cancelling/Withdrawing. Please guide me on how to modify the workflow to bring this situation.

Thanks,
USSKT
  • Hi TPRMT,

    Try placing the below script in trigger record of cm3r as:

    Task_Status.JPG

    if (record['category']=='Normal Change' && record['current.phase']=='Deployment') {
    
    var trel = new SCFile("cm3t");
    var query = "parent.change = \""   record.number   "\"";
    if ( trel.doSelect( query ) == RC_SUCCESS )
     {
      do
       {
         trel['status']='20';    // 20 is the status code for "Completed"
         trel['current.phase']='Deployment';
         trel['account.type'] = 'Common';
        trel.doAction("save");
       }
      while (trel.getNext() == RC_SUCCESS); 
     }
     }

    Thanks

    Neo

  • Hello Neo,

    Thanks for the help. Do you want to me add "Set.Change.Task.Status" a new trigger to cm3r triggers? Because i don find one already in my SM. Attached the list of triggers that i have in my cm3r on 4- After update.

    Please clarify me. Thanks.

    USSKT.

  • Hello Neo,

    I have tried the steps you insisted. But the issue i have faced is,

    1. I can only create change task during "Registration and Categorization" Phase or "Risk and Impact Analysis" Phase. 

    2. After creating, when i move the ticket from any of the two phase to "Build and test" or "deployment authorization, it throws the error " the change cannot move a phase until following task are closed".

    3. As you know i cannot create a valid task once the ticket is in "Deployment"/Build and test phase. 

     

    So testing the code you provided is itself not feasible here. Please guide me on this.

     

    Thanks for the effort to help me.

     

    USSKT.

  • Hi TPRMT,

    1. I can only create change task during "Registration and Categorization" Phase or "Risk and Impact Analysis" Phase. 

    -  Its upto your process flow wherein tasks need to be introduced.

    2. After creating, when i move the ticket from any of the two phase to "Build and test" or "deployment authorization, it throws the error " the change cannot move a phase until following task are closed"

     You can diable the validation from system by unchecking , refer to below screenshot: Pls not this is just an example , please align as per the workflow implemented in your enviornment.

    SS.jpg

    3. As you know i cannot create a valid task once the ticket is in "Deployment"/Build and test phase. 

    Yes again it depends on the flow in your enviornmtn.

    Above script will help you change the task status to closed so once the change is abondoned, let say in XYZ phase, in that phase follow the point 2 screenshot & allow the change request to pass from XYZ phase to Abandon phase. In the trigger records place this script and modify the script as :

    if (record['category']=='Normal Change' && record['current.phase']=='Abandon') {
    
    var trel = new SCFile("cm3t");
    var query = "parent.change = \""   record.number   "\"";
    if ( trel.doSelect( query ) == RC_SUCCESS )
     {
      do
       {
         trel['status']='20';    // 20 is the status code for "Completed"
         trel['current.phase']='Deployment';
         trel['account.type'] = 'Common';
        trel.doAction("save");
       }
      while (trel.getNext() == RC_SUCCESS); 
     }
     }

     Thanks

    Neo

  • Hello Neo,

     

    Thanks for the help. Just a quick question on the same. Lets say when i abandon the change, i want to auto cancel the task that are in Planned, Ready, Assigned Status. How to acheive this please. 

    Any help is much appreciated.

    Thanks,

    USSKT.

  • Verified Answer

    Hi TPRMT,

    As you mentioned, when you abandon the chnage ( I'm assuming there is phase called abandon in change workflow), if that is the case the above script can be used to auto cancel teh task by just update in the script as:

    trel['status']='30'; // 30 is the status code for "cancelled"
    trel['current.phase']='Cancelled';
    trel['closing.comments'] = 'Change Taks has been auto cancelled';

    Thanks

    Neo