- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-14-2022 02:34 AM
Hi,
I have a requirement wherein when a person is creating a request and the requested for is some other person for whom the form is not available, I need to alert the user that a request cannot be raised for this person since the form is not available for him. Please advise on how to proceed with this.
Thanks,
Garima
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-14-2022 03:05 AM
Hi,
If Requested for is a field on the form, try to use 'Requested For' variable type instead of reference type
If the Requested for user doesn't fall under the user criteria, below error message will be displayed and form won't get submitted.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-14-2022 05:28 AM
Hi,
then you can use this logic
1) onChange of that user variable use GlideAjax and pass that user
2) then in script include function use User Criteria Loader Script
use this script to get the user criteria that user satisfies; then search in that the sysId of the User criteria which is present to your catalog item
var arr = new sn_uc.UserCriteriaLoader.getAllUserCriteria(<passSysIdHere>);
var sysIdToSearch = ''; // give the sysId here
if(arr.indexOf() > -1){
return 'valid';
}
else{
return 'invalid';
}
Regards
Ankur
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-14-2022 03:05 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-14-2022 03:26 AM
Hi Thanks a lot @StarK , this helped, could you also help me customise this error message?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-14-2022 03:32 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-14-2022 03:38 AM
Hi,
What if I want the message to be dynamic according to the requested for user.