Create Change Tasks from business rules

Pallavi65
Tera Contributor

Hello all,

 

Once a change request is created on a condition, I want to create 4 Change tasks automatically with unique short description and assign each of them to a different group.

For example,

CTASK1:-

Short description: Enable User in AD 

Assignment Group: Active Directory

 

CTASK2:-

Short description: Provide Asset 

Assignment Group: Asset Managenent

 

CTASK3:-

Short description: ID creation 

Assignment Group: Infrastructure department

 

I have written an after-insert BR, on change request table but it's not working.

Can someone modify my code and help me.

 

Pallavi65_0-1683111662679.png

 

 

Regards,

Pallavi

 

1 ACCEPTED SOLUTION

Try this

var ar = ['Enable User in AD', 'Provide Asset', 'ID Creation'];

 

    for(var i = 0; i < ar.length; i++) {
        gs.log("inside for");
        var gr = new GlideRecord('change_task');
        gr.initialize();
        gr.change_request = current.sys_id;
        gr.short_description = ar[i];
        gr.u_chgtask_environment = current.u_environment;
        gr.cmdb_ci = current.cmdb_ci;
        gr.planned_start_date = current.start_date;
        gr.planned_end_date = current.end_date;
if(ar[i].toString()=='Enable User in AD ')
gr.assignment_group = 'Active Directory';
else if(ar[i].toString()=='Provide Asset')
gr.assignment_group = 'Asset Management';
else if(ar[i].toString()=='ID creation')
gr.assignment_group = 'Infrastructure department';
        gr.insert();
    }
-Anurag

View solution in original post

5 REPLIES 5

Nicole Disbro
Tera Expert

There is out of box function for this also! When making a Change Proposal, there is a related list to populate Change Tasks!