Script for create a new task

Alessia Russo
Tera Expert

Hi everybody ! I need to create a new task from another task. So I've used a BR, but I think something is wrong with my script, somebody could help me and tell me how to correct it? Thanks.

 

The script in the BR (I set condition when to run with update and insert and when the state changes to 'waiting for delivery'):

(function executeRule(current, previous /*null when async*/) {
var task = new eyRmaNcUtils(); 
task.assignment_group = '445334299780e1981fadb6e3f153aff2'; //change assignment group in the new one
task.current.state = 160; //set the state of the new task
current.update();
action.setRedirectURL(current);

})(current, previous);

5 REPLIES 5

Pavankumar_1
Mega Patron

Hi @Alessia Russo ,

If you trying on UI action to create task refer below link.

https://www.servicenow.com/community/itsm-forum/ui-action-to-create-record-in-another-table/m-p/8341...

If it helps please click Accept as Solution/hit the Thumb Icon.
ServiceNow Community MVP 2024.
Thanks,
Pavankumar