- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-21-2018 06:59 AM
Need to create a task manually via Workflow under the RITM . I have RITM created but unable to add the catalog tasks underneath that in servicenow
var tsk = new GlideRecord('sc_task');
tsk.initialize();
tsk.request_item = current.sys_id;
tsk.state = 1;
task.insert();
Please let me know if any additions needed or do we have any other process ?
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-21-2018 10:27 AM
There are syntax errors. I corrected them. try this.
var tsk = new GlideRecord('sc_task');
//test
tsk.initialize();
//tsk.u_access_requested_for = current.variables.u_term_name;
// tsk.due_date = current.due_date;
//tsk.description = reqItem.sys_id;
//tsk.request_item = reqItem.sys_id;
tsk.request_item = workflow.scratchpad.reqItem;
tsk.state = 1;
tsk.approval.setDisplayValue('Approved');
tsk.assignment_group = "sys_id of GRP";
tsk.insert();
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-21-2018 10:33 AM
yes , i will change this to to TASK to TASK . But it is not even creating one task under that RITM .

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-21-2018 10:27 AM
There are syntax errors. I corrected them. try this.
var tsk = new GlideRecord('sc_task');
//test
tsk.initialize();
//tsk.u_access_requested_for = current.variables.u_term_name;
// tsk.due_date = current.due_date;
//tsk.description = reqItem.sys_id;
//tsk.request_item = reqItem.sys_id;
tsk.request_item = workflow.scratchpad.reqItem;
tsk.state = 1;
tsk.approval.setDisplayValue('Approved');
tsk.assignment_group = "sys_id of GRP";
tsk.insert();
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-21-2018 02:28 PM
This helped me . Thanks . And in addition to this . Can we Just pull all the variables from the order guide to the manually created TASKS . Is there a way to this because i dont want to do via Maintain Items form .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-21-2018 08:50 AM
Use var gr = new GlideRecord('sc_req_item'); // to create a new record (RITM) on the request item list
more info here
https://www.servicenowguru.com/scripting/gliderecord-query-cheat-sheet/
Hope this helps