Multiple Change tasks

diannemcintosh
Tera Contributor

I'd like to open multiple (1000+) change tasks for one parent Change Request. Each Change Task would reference a different Server CI. Any ideas on how to automate this?

8 REPLIES 8

Kalaiarasan Pus
Giga Sage

Use a run script activity in the workflow ....


randrews
Tera Guru

kalaiarsan p is correct in that you would use a run script on the workflow generally.. but i have to ask.. is this the right way?!



Are your change owners and techs going to be able to work hundreds of tasks on each of   these changes... what value is gained from them.. if it is just to show the ci's i would load them in the affected ci's instead of creating a task....



i am confused as to how over 100 tasks on a change will help the process.


aduncanvickery
Tera Expert

I work closely with the Infrastructure team in my organization, and they originally had this intent: one Change/Task per CI.   I suggested a couple other options: First, one Change each for a group of High / Moderate / Low-Criticality systems (the application or business service platform running on the servers usually sets criticality), and lump all the affected servers in as "Affected CIs".   Or, one Change per maintenance window (MS Patches are usually on that Patch Tuesday's weekend maintenance cycle), and group Tasks with who needs to perform maintenance on a group of servers.



Adding tons and tons of child tasks probably isn't necessary, and if it's done just for like reporting purposes, you can get the same kind of data using Affected CI.



Note: The teams ended up creating one "master" Change Request for each major maintenance cycle (monthly for MS Updates, for example) and sending one child Task to each major stakeholder who will be performing the updates, on the whole group of servers.   They've also opted to not track individual CIs in these records, as soon as they realized the overhead that would be required.


aduncanvickery
Tera Expert

I'd create a run script in your change management workflow, to key off a custom field in the Change (something like u_change_type with a value of "server_patch") that looks something like this (my script is definitely not complete):



if (current.u_change_type == 'server_patch'){


  var srv = new GlideRecord('cmdb_ci_win_server');


  srv.addQuery('os', 'startswith', 'Windows 2008');


  srv.query();



  while (gr.next()) {


  var ctask = new GlideRecord('change_task');


  ctask.initialize();


  ctask.short_description = "Install Patches on " + srv.name;


  ctask.description = "Please install the server patches on this machine.";


  ctask.parent = current.sys_id;



  ctask.insert();


  }


}