How do I create multiple change tasks when a change request is submitted with a specific selected category as the condition.

Anthony Jimenez
Kilo Explorer

I want the change task (or multiple tasks) to be created when the user submits a change request with the selected category "System Software". 

Here is what I have:

function onSubmit() {
  var cat = g_form.getValue('category');


if(cat == "System Software")
    {
        var cTask = new GlideRecord('change_task'); 
        cTask.initialize();
        cTask.assignment_group = current.assignment_group;
        cTask.short_description = 'Install URS Launcher on ' + pc;
        cTask.insert();
    }

6 REPLIES 6

Hello Sumanth, I want the change task (or multiple tasks) to be created when the user submits a change request with the selected category "System Software". 

@Anthony Jimenez 

You cannot use GlideRecord in client scripts.

GlideRecord is meant for server scripts only.

Create a business rule on change request table instead of client script.

Condition: INSERT

Filter : category is System software

script

if(current.category == "System Software") //check system software backend value
    {
        var cTask = new GlideRecord('change_task'); 
        cTask.initialize();
        cTask.assignment_group = current.assignment_group;
        cTask.short_description = 'Install URS Launcher on ' ; 
        cTask.insert();
}

 

Mark as correct and helpful if it solved your query.

Regards,
Sumanth