- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
When we used the GET with the case number to query case by id, the result is "record not found". If i changed to the case sys_id, everything works fine.
I checked and found that it's failing when we do if (gr.get('number')), which returns false, so the rest of the logic is not executed.
Has anyone faced this issue and been able to resolve it?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
as you can see it's using GlideRecordSecure so it will evaluate ACL for your API user
is that user able to see that in UI using normal table list?
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday - last edited yesterday
Hi @ManasiP,
If you want to query a record with the Case Number please also provide the value
if(gr.get('number','YOUR_CASE_NUMBER'))because this is the required parameter for get() method
If my response helped, please mark it as the accepted solution so others can benefit as well.
Muhammad Iftikhar
If my response helped, please mark it as the accepted solution so others can benefit as well.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
HI @M Iftikhar , I checked this but there are many api's oob which directly queries on number or any other field by using gr.get("CS0002010") and this is very basc api, its failing in a customer instance but passing on other instances.
Also, the way "query case by id" api is written on case table, the logic directly queries on number.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
gr.get("CS0002010") works only if the string matches the record’s sys_id or if the instance internally allows lookup by display value (like number). This behavior varies across instances due to differences in platform version, ACLs, or configuration.
The correct and reliable way to query by number is:
gr.get('number', 'CS0002010');or use a query:
gr.addQuery('number', 'CS0002010'); gr.query();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
is it working with admin?
If yes and not with non-admin then check this
-> CSM Query rule
-> Query BR on Case table is restricting
it's an OOTB scripted REST API and here is the info, you can see which endpoint and HTTP Method is good for you
it worked for me as admin with Both Number
https://instanceName.service-now.com/nav_to.do?uri=sys_ws_definition.do?sys_id=771aaa2f5342030097a2ddeeff7b127d
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
