Change Tasks are not created for Standard Change

Sruthi17
Kilo Sage

I have created a BR, that is "if a new change is created" ,  2 change tasks should be created

It is working fine with Normal Change and Emergency Change. But the change tasks are not created for Standard change

Can someone help me debug the issue?

2 REPLIES 2

ABHAY_M
Tera Guru

can you share screenshots of the BR you have written to create cTASK?

Sruthi17
Kilo Sage

(function executeRule(current, previous /*null when async*/ ) {
gs.addInfoMessage('BR Triggered');
var isBR = '';
var acc = current.u_account.split(',');
gs.addInfoMessage('Account : ' + acc[0]);
var ca = new GlideRecord('customer_account');
ca.addQuery('sys_id', acc[0]);
ca.query();
if (ca.next()) {
gs.addInfoMessage('Account Found');
if (ca.u_operating_unit == 'BR') {
isBR = '1';
gs.addInfoMessage('Brazil Account');
}
}
// Add your code here
if (isBR == '1') {
var ct = new GlideRecord('change_task');
gs.addInfoMessage("Task Created");
//Create a new Rollback Task
ct.initialize();
ct.change_request = current.sys_id;
ct.change_task_type = 'rollback';
ct.short_description = 'Rollback plan';
ct.assignment_group = '';
ct.state = '1';
ct.created_from = 'Workflow';
ct.insert();
//Create a new Pre-Implementation Task
ct.initialize();
ct.change_request = current.sys_id;
ct.change_task_type = 'pre-implementation';
ct.short_description = 'Test plan and/or Test results before implementation';
ct.assignment_group = '';
ct.state = '1';
ct.created_from = 'Workflow';
ct.insert();
}

 

})(current, previous);