Visitor Management : Restrict visitor limit for a location
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi everyone,
We have a requirement in ServiceNow Workplace Service Delivery / Visitor Management and would like to know if there is any out-of-the-box (OOTB) functionality to support it.
Our requirement is to enforce a daily visitor capacity per location:
- Display a warning message to the host once 50 visitors have been registered for a location on a given day.
- Prevent any further visitor registrations once the total reaches 70 visitors for that location.
- The validation should also consider the number of visitors being registered in the current request. For example, if 65 visitors are already registered and a host attempts to register 10 more visitors in a single registration, the request should be blocked because the total would exceed the limit of 70.
We would prefer to achieve this with minimal customization.
Has anyone implemented a similar requirement? Is there any OOTB feature, property, or configuration in WSD/Visitor Management that supports location-based daily visitor capacity limits, or is customization (e.g., Business Rule/Script Include/Flow) the recommended approach?
Any guidance or best practices would be greatly appreciated.
Thank you!!
- Labels:
-
Rome
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 weeks ago
Hi @mehtaaaksha
As per my knowledge currently no OOTB feature for your requirement.
Minimum customization will be a business rule, following as an example. Replace fields as per your requirement/Instance.
(function executeRule(current, previous) {
var WARNING_LIMIT = 50;
var MAX_LIMIT = 70;
var location = current.location;
var visitDate = current.expected_arrival;
if (!location || !expected_arrival)
return;
var ga = new GlideAggregate('sn_wsd_visitor_visitor_registration');
ga.addQuery('location', location);
ga.addQuery('expected_arrival', expected_arrival);
// ga.addQuery('state', '!=', 'cancelled');
ga.addAggregate('COUNT');
ga.query();
var currentCount = 0;
if (ga.next()) {
currentCount = parseInt(ga.getAggregate('COUNT'), 10);
}
var newTotal = currentCount + 1;
if (newTotal > MAX_LIMIT) {
gs.addErrorMessage(
'Maximum visitor capacity of ' + MAX_LIMIT +
' has been reached for this location on ' +
expected_arrival.getDisplayValue() + '.'
);
current.setAbortAction(true);
return;
}
if (newTotal >= WARNING_LIMIT) {
gs.addInfoMessage(
'Warning: Visitor count for this location is ' +
newTotal + '. The warning threshold is ' +
WARNING_LIMIT + '.'
);
}
})(current, previous);