- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-24-2025 12:16 AM - edited ‎04-24-2025 12:46 AM
In the catalog item, we have requested for variable under which we can enable also request for. The also request for enables in raising request for multiple requestors. I have a requirement to abort submitting the request even if one of the requestor's locations is out of India. How can this be achieved.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-27-2025 07:40 PM
Hope you are doing good.
Did my reply answer your question?
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-24-2025 12:31 AM
I’m not sure what the backend of your use case is, but if the request location is not India, it will be considered as another route or location outside of India. However, make sure all required location data is updated in the user table.
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-24-2025 12:49 AM
is requestor a list collector variable reference to sys_user?
If yes then why not restrict the users itself by adding reference qualifier
javascript:'location.country!=India';
if not then you can use onChange + GlideAjax and then validate this
even if 1 user has location outside India then show error in field message
Client Script:
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue === '') {
return;
}
var requestorIds = g_form.getValue('requestors'); // Assuming 'requestors' is the field with multiple requestors
var ga = new GlideAjax('CheckRequestorLocation');
ga.addParam('sysparm_name', 'checkLocations');
ga.addParam('requestorIds', requestorIds);
ga.getXMLAnswer(function(response) {
if (response.toString() == 'true') {
g_form.addErrorMessage('One or more requestors are located outside India.');
} else {
g_form.clearMessages();
}
});
}
Script Include: It should be client callable
var CheckRequestorLocation = Class.create();
CheckRequestorLocation.prototype = Object.extendsObject(global.AbstractAjaxProcessor, {
checkLocations: function() {
var requestorIds = this.getParameter('requestorIds');
var userGr = new GlideRecord('sys_user');
userGr.addQuery('sys_id', 'IN', requestorIds);
userGr.addQuery('location.country', 'India');
userGr.setLimit(1);
userGr.query();
return userGr.hasNext();
},
type: 'CheckRequestorLocation'
});
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-24-2025 01:45 AM
Please find the attached screenshot. We have this requested for enabling multi requestors in OOB.
I want to fetch the sysids of users under Also request for field (in screenshot) and validate their location.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-24-2025 01:55 AM
why not restrict the users itself by adding reference qualifier, something like this
but please enhance
javascript:'location.country!=India';
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader