CA Service Management

 View Only
  • 1.  close bulk tickets with comments in CA service desk r12.7.

    Posted Feb 05, 2018 12:44 PM

    Hello All,

     

    We have a requirement to close bulk tickets with comments in CA service desk r12.7. Can someone help me the same.

     

    Thanks

    Prem Vikas K



  • 2.  Re: close bulk tickets with comments in CA service desk r12.7.
    Best Answer

    Posted Feb 05, 2018 01:16 PM

    Hi, 

    I can't attach script as file, so copy followed code and save it as z_status_change.frg

    You need to define correct where_clause (search query), new status code and status change comment on line 27, 57, 58.

    Run command could be found within script file.

    ///////////////////////////////////////////////////////////////////////////////////////////////
    //
    //     fileName: z_status_change.frg
    //
    //     run:
    //          bop_cmd -u ServiceDesk -f z_status_change.frg stInit() > status_change.txt
    //
    //     description:
    //          batch status changer
    //
    //     by:
    //          cdtj71@gmail.com
    //
    ///////////////////////////////////////////////////////////////////////////////////////////////

    #define MSG_ERROR for(msg_i=0;msg_i<msg_length();msg_i++) { logf(ERROR, "msg[%d]: %s", msg_i, msg[msg_i]); }
    #define MSG_SIGN for(msg_i=0;msg_i<msg_length();msg_i++) { logf(SIGNIFICANT, "msg[%d]: %s", msg_i, msg[msg_i]); }
    #define MSG_BOTH if (msg_error()) { MSG_ERROR return; } else { MSG_SIGN }

    stInit(...) {
         set_ilimit(2147483648);
         string wc;
         int msg_i, zcount, i;
         object cr, zfound;

         // Define your wherecaluse here:
         wc = "id IN (5904179,5907121,5907172,5922428,5924266,5926653,5928594,5928599,5928827,5929126,5929343,5929363,5929420,5929633,5930136) AND active = 1 AND resolve_date is NULL";

         send_wait(0, top_object(), "call_attr", "cr", "sync_fetch", "STATIC", wc, -1, 0);
         zcount = msg[1];
         printf("Found: %d\n", zcount);
         if (zcount > 0) {
              zfound = msg[0];
              for (i=0;i<zcount;i++) {
                   send_wait(0, zfound, "dob_by_index", "DEFAULT", i, i);
                   if (msg_error()) {
                        printf("[%d] > Unablte to dob_by_index\n", i);
                        MSG_ERROR
                   } else {
                        cr = msg[0];
                        st(cr);
                   }
              }
         }
    }

    int st(object cr_obj) {
         uuid who;
         int msg_i;
         object gl;

         // New status code and Comment
         string comment, new_status;
         new_status = "CNCL";
         comment = "Rejected by Sith Lord";

         send_wait(0, top_object(), "get_co_group");
         gl = msg[0];
         send_wait(0, top_object(), "call_attr", "cnt", "current_user_id");
         who = msg[0];
         printf("\tprocessing: %s...", cr_obj.ref_num);
         send_wait(0, cr_obj, "change_status", gl,
              who,
              comment,
              new_status,
              NULL
         );
         // send_wait(0, cr_obj, "call_attr", "string1", "set_val", "BATCHED", "SURE_SET");

         send_wait(0, gl, "checkin");
         if (msg_error()) {
              send_wait(0, gl, "uncheck");
              printf("fail\n");
              return 1;
         } else {
              printf("ok\n");
              return 0;
         }
    }

    PS: test it well and use it at your own risk.

     

    Regards,

    Timur Alimov



  • 3.  Re: close bulk tickets with comments in CA service desk r12.7.

    Posted Feb 05, 2018 01:43 PM

     

    Hi,

     

    I am getting the above error. Could you please check



  • 4.  Re: close bulk tickets with comments in CA service desk r12.7.

    Broadcom Employee
    Posted Feb 05, 2018 01:46 PM

    What directory do you have the z_status_change.frg stored in?



  • 5.  Re: close bulk tickets with comments in CA service desk r12.7.

    Posted Feb 05, 2018 01:51 PM

    In desktop



  • 6.  Re: close bulk tickets with comments in CA service desk r12.7.

    Posted Feb 05, 2018 02:10 PM

    type

    cd Desktop

    to move to the same location and rerun the script.



  • 7.  Re: close bulk tickets with comments in CA service desk r12.7.

    Posted Feb 05, 2018 08:29 PM

    If you want a solution that can be used by analysts then you can use a customization I shared last year. It adds a log command and manual notify functionality to edit in list.

    Log Comment and Manual Notify from Edit in List 



  • 8.  Re: close bulk tickets with comments in CA service desk r12.7.

    Broadcom Employee
    Posted Feb 06, 2018 10:31 AM

    Prem...........

     

    Were you able to successfully run the bop_cmd command?