- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-13-2022 04:20 AM
Hi i am trying to get the cat_item from the sc_req_item and trying to copy it to the sc_task to add a condition to an acl.
This is what i got
1- This script gives me all the cat_item names but not the current cat_item from the sc_req_item
var target = new GlideRecord('sc_req_item');
target.addQuery('active', true);
target.query();
while (target.next()) {
gs.log("Item Name-"+target.cat_item.name);
}
2- This gives me an undefined value
var rec = new GlideRecord('sc_req_item');
rec.addQuery(current.cat_item);
rec.query();
gs.log(current.cat_item );
Thank you
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-13-2022 04:44 AM
Thanks. In your existing script replace
target.cat_item.name
with
current.request_item.cat_item.name

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-13-2022 04:36 AM
Hi Samuel,
You can directly dot walk in your ACL which is created on the sc_task table and fetch the catalog item record.
Regards,
Deepankar Mathur
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-13-2022 04:38 AM
Hi, you mean i can directly get the cat_item values from the sc_req_item?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-13-2022 04:42 AM
yes, to get it from RITM you can use current.cat_item, for sc_task use current.request_item.cat_item
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-13-2022 04:39 AM
Hi,
to get catalog item name in ACL of sc_task use this
var itemName = current.request_item.name;
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-15-2023 01:16 PM
This looks to be out of the box in Utah. sc_task.cat_item with a default javascript to populate the reference.