- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2024 05:02 AM
Hi,
I'm trying to get the catalog tasks related to a request in a client script
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2024 05:14 AM
Hi @Neil Santucci ,
You are using wrong syntax in addQuery part, you need to remove the + sign or use addEncodedQuery instead and your syntax in alert is also wrong. I've added the code with improved syntax below:
var ritmID = g_form.getUniqueValue();
try {
var scTaskGr = new GlideRecord('sc_task');
scTaskGr.addQuery('request_item', ritmID); // Use addQuery with two arguments
scTaskGr.query();
while (scTaskGr.next()) {
alert(scTaskGr.sys_id + " " + scTaskGr.short_description); // Use + for concatenation
}
}
catch(err) {
alert(err.message);
}
Thanks,
Hope this helps.
If my response proves helpful please mark it helpful and accept it as solution to close this thread.😊
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2024 05:14 AM
Hi @Neil Santucci ,
You are using wrong syntax in addQuery part, you need to remove the + sign or use addEncodedQuery instead and your syntax in alert is also wrong. I've added the code with improved syntax below:
var ritmID = g_form.getUniqueValue();
try {
var scTaskGr = new GlideRecord('sc_task');
scTaskGr.addQuery('request_item', ritmID); // Use addQuery with two arguments
scTaskGr.query();
while (scTaskGr.next()) {
alert(scTaskGr.sys_id + " " + scTaskGr.short_description); // Use + for concatenation
}
}
catch(err) {
alert(err.message);
}
Thanks,
Hope this helps.
If my response proves helpful please mark it helpful and accept it as solution to close this thread.😊
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-30-2024 11:53 PM
thanks HrishabhKumar, that works, knew it'd be something simple. Thanks for your help
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-08-2024 03:28 AM
Hi HrishabhKumar,
I'm hoping that you can help with a follow up question. I got the code you provided working client side in the Core UI, next I need to do the same for Service Operations Workspace. The code runs but it doesn't return any catalog tasks and no errors either. Any ideas?
Thanks
Neil