Skip to content

Commit 6162b1e

Browse files
Add README for incident count snippet
Added comprehensive README documentation for the incident count snippet with usage examples and API references
1 parent e2b2fd1 commit 6162b1e

1 file changed

Lines changed: 34 additions & 0 deletions

File tree

  • Core ServiceNow APIs/GlideRecord/IncidentCount
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Incident Count
2+
3+
## Description
4+
This snippet demonstrates how to count the total number of incident records in ServiceNow using the GlideRecord API.
5+
6+
## Usage
7+
This code can be run in:
8+
- Background Scripts
9+
- Script Includes
10+
- Business Rules
11+
- Scheduled Jobs
12+
13+
## Code Example
14+
```javascript
15+
var gr = new GlideRecord('incident');
16+
gr.query();
17+
var count = gr.getRowCount();
18+
gs.info('Total number of incidents: ' + count);
19+
```
20+
21+
## API Used
22+
- GlideRecord - Core ServiceNow API for database operations
23+
- getRowCount() - Returns the number of rows in the query result
24+
25+
## Notes
26+
- This snippet uses getRowCount() which is efficient for counting records
27+
- The query() method must be called before getRowCount()
28+
- You can add encoded queries before calling query() to count specific records
29+
30+
## Related
31+
- [GlideRecord Documentation](https://developer.servicenow.com/dev.do#!/reference/api/latest/server/no-namespace/c_GlideRecordScopedAPI)
32+
33+
## Tags
34+
#GlideRecord #Incidents #Count #ServerSide

0 commit comments

Comments
 (0)