Assistance needed with Client Script failing.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2024 08:55 AM
Hello,
I'm certain that the approval table contains Abel Tuter is one of the approver. However, I'm not sure why the client script is returning "Record Not Found". Please help take a look at the script. Thank you
var sysID = '1159195c8376021008469796feaad3fa'; // ritm sys id
var approverSysID = 'e12f071f833e8a1008469796feaad320'; // Abel Tuter
var approvalcheck = new GlideRecord('sysapproval_approver');
approvalcheck.addQuery('sysapproval', sysID);
approvalcheck.addQuery('approver', approverSysID);
approvalcheck.query();
var result = '';
if (approvalcheck.next()) {
result = gs.print('Record Found');
} else {
result = gs.print('No Record Found');
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2024 09:10 AM
Hi @Keang
I tried executing Your Code In my PDI Instance in the background script, and it is working fine. Please check again the sysid's that you have mentioned in the script.
Thanks and Regards
Sai Venkatesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2024 09:32 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2024 11:30 AM
Hey @Keang
If this isn't working in your instance then I'm guessing you're running it from a scoped application. Client side GlideRecord doesn't work in Scope, and even though it's available it really shouldn't be used in Global either. You'll have to use a GlideAjax.