- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-14-2023 12:49 PM
Greetings,
I am trying to create a UI Action that will allow the Service Desk to add Additional SCTASK(s) to any Open RITM.
Thank you in advance for any guidance 🙂
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-14-2023 01:17 PM - edited 04-14-2023 01:21 PM
Copy the below script to your UI action:
UI Action name - " whatever "
Table - sc_req_item
Client - keep it un-ticked (false)
var sc = new GlideRecord('sc_task');
sc.newRecord();
sc.setValue('short_description', current.getValue('short_description'));
sc.setValue('description', current.getValue('description'));
sc.setValue('assignment_group', current.getValue('assignment_group'));
sc.setValue('request_item', current.getValue('sys_id'));
sc.setValue('request', current.getValue('request'));
// add required fields
var recSysId = sc.insert(); // create catalog task
// to copy variable on catalog task
var gr = new GlideRecord('sc_item_option_mtom');
gr.addQuery('request_item.numberSTARTSWITH' + current.getValue('number'));
gr.query();
while (gr.next()) {
var grt = new GlideRecord('sc_item_variables_task');
grt.newRecord();
grt.setValue('task', recSysId);
grt.setValue('variable', gr.sc_item_option.item_option_new.toString());
grt.insert();
}
Please be kind enough to mark my answer correct and helpful.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-14-2023 01:17 PM - edited 04-14-2023 01:21 PM
Copy the below script to your UI action:
UI Action name - " whatever "
Table - sc_req_item
Client - keep it un-ticked (false)
var sc = new GlideRecord('sc_task');
sc.newRecord();
sc.setValue('short_description', current.getValue('short_description'));
sc.setValue('description', current.getValue('description'));
sc.setValue('assignment_group', current.getValue('assignment_group'));
sc.setValue('request_item', current.getValue('sys_id'));
sc.setValue('request', current.getValue('request'));
// add required fields
var recSysId = sc.insert(); // create catalog task
// to copy variable on catalog task
var gr = new GlideRecord('sc_item_option_mtom');
gr.addQuery('request_item.numberSTARTSWITH' + current.getValue('number'));
gr.query();
while (gr.next()) {
var grt = new GlideRecord('sc_item_variables_task');
grt.newRecord();
grt.setValue('task', recSysId);
grt.setValue('variable', gr.sc_item_option.item_option_new.toString());
grt.insert();
}
Please be kind enough to mark my answer correct and helpful.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-14-2023 01:33 PM
Thank you SO much for your guidance! I am so fortunate to have 3 responses and will advise soon 🙂

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-14-2023 02:34 PM - edited 04-14-2023 02:35 PM
Go my way. Trust me its working i have tried
Please be kind enough to mark the solution Correct and helpful
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-14-2023 03:14 PM
Kudos my friend, thank you!!