We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

creation of record in table in same table business rule

Tippireddy Venk
Tera Contributor

I'm  working on sc task business rule. I want to create a  record in sc task if category is monitorig please help me to create a record.

1 REPLY 1

Harish Bainsla
Kilo Patron

Hi create Br

(function executeRule(current, previous /*null when async*/) {


if (current.category == 'monitoring') {

var newTask = new GlideRecord('sc_task');
newTask.initialize();
newTask.short_description = 'Your Short Description Here';
newTask.description = 'Your Description Here';
newTask.category = 'monitoring';
var newTaskID = newTask.insert();

gs.print('New SC Task created with sys_id: ' + newTaskID);
}

})(current, previous);