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

Can some one help me how to trigger manual REQ,RITM and SCTask via scripting

NagaNandini N
Tera Guru

Hi All,

 

We have a legal record producer and on selecting one particular category " AI system review " it needs to create legal requests and SC tasks as well and assign them to a particular group and a person with the details. It is an urgent requirement. Please help me with this.

 

Please find the code for reference.

 

var rpId = RP.getParameterValue('sysparm_id');
new LegalRequestWrapper(current, rpId);
current.lg_subcategory = producer.sub_category;
current.priority = producer.priority;
current.assignment_group_permission = 'edit';
current.assignment_group = '8bad2605bd542010fa9be6f75cff6304'; //OGC Legal Contracts Support
current.assignment_group_permission = 'edit';
current.assigned_to = 'a8486e6b1b9a8c50031640c8cc4bcb8e';//Maggie Conerly

var tt = producer.sub_category;
if(tt == 'AI system review')
{
    current.setAbortAction(true);
    var gr=new GlideRecord('sc_task');
    gr.initialize();
    gr.assignment_group = '15fd53e01b85c0100da14223cd4bcbb4'; //GTS Service Desk Group
    gr.assigned_to = '1c13f54a1b12c850031640c8cc4bcb13'; // Chris Farrow
    gr.insert();
}
 
 

 

 
1 REPLY 1

Gangadhar Ravi
Giga Sage