- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-30-2022 07:30 AM
How can you make a counter that count the number of time a page have been view or visited, I thought that we can use a on-load client script but some people tell me to do display business rule. I been trying with both but I can't seem to make it increase when I visit the page only when I save the form was it able to increase the counter.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-30-2022 07:43 AM
Create a new field [Counter] on the table of type integer.
Create a display business rule and add below script
ServiceNow Community Rising Star, Class of 2023
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-30-2022 07:43 AM
Create a new field [Counter] on the table of type integer.
Create a display business rule and add below script
ServiceNow Community Rising Star, Class of 2023
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-30-2022 07:44 AM
Hi @edwardwong
Do you want to make it generic for overall users or based upon the users ?
If you have any field to store that number then you can do something like below for all the users :-
Display Business Rule :-
// Set the number of times the record has been opened to 0
current.u_num_opened = 0;
// Increment the number of times the record has been opened by 1
current.u_num_opened += 1;
// Update the record with the new value
current.update();