The Zurich release has arrived! Interested in new features and functionalities? Click here for more

Create Change task Through Ui Action

rakshith_shetty
Tera Contributor

Hi Team

 

I need assistance with developing a new UI action for the related list. Specifically, I would like to implement functionality where, upon clicking on the related list button , five change tasks Should be generated . Could someone please provide a code examples for creating the change tasks? Additionally, this UI action should only be visible when the short description of the change request is set to "Server Patching"

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@rakshith_shetty 

it should be list banner button with script like this, please enhance as per your requirement

for (var i = 1; i <= 5; i++) {
    var task = new GlideRecord('change_task');
    task.initialize();
    task.change_request = current.sys_id; // Link to parent Change Request
    task.short_description = "Task " + i + " for Server Patching";
    // Set other fields as needed
    task.insert();
}
action.setRedirectURL(current); // Refresh the form

UI action will look like this, please enhance if required

AnkurBawiskar_0-1746528263971.png

 

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

2 REPLIES 2

Ankur Bawiskar
Tera Patron
Tera Patron

@rakshith_shetty 

it should be list banner button with script like this, please enhance as per your requirement

for (var i = 1; i <= 5; i++) {
    var task = new GlideRecord('change_task');
    task.initialize();
    task.change_request = current.sys_id; // Link to parent Change Request
    task.short_description = "Task " + i + " for Server Patching";
    // Set other fields as needed
    task.insert();
}
action.setRedirectURL(current); // Refresh the form

UI action will look like this, please enhance if required

AnkurBawiskar_0-1746528263971.png

 

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@rakshith_shetty 

Hope you are doing good.

Did my reply answer your question?

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader