- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2022 03:32 AM
We have impletemented a "Available For" User Criteria on a record producer. In the portal, users will not see the record producer in the catalog list. This is as expected and works perfectly.
But if users attempt to access the record producer directly thorough an external link, users that do not meet the user criteria see a blank page. This is confusing the users and they are unsure why they see a blank screen.
Is there a way that we can redirect the users to a different page if they do not meet the user criteria for a record producer?
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2022 03:50 AM
You can write an onload script on the record producer.
I have done to check if user has certain role or not.
You can similarly have check for certain conditions based on user criteria and if server side scripting is required you can get that from GlideAjax, and in your callback function response you can include top.window() function to redirect user to any url you want.
if(!g_user.hasRole("test_role")){
var url = "https://community.servicenow.com/communityid=community_user_profile&user=33b26047db00441823f4a345ca96192a";
top.window.open(url, "_blank");
}
Feel free to mark correct, If I answered your query.
Will be helpful for future visitors looking for similar questions 🙂
Aman Kumar

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2022 03:50 AM
You can write an onload script on the record producer.
I have done to check if user has certain role or not.
You can similarly have check for certain conditions based on user criteria and if server side scripting is required you can get that from GlideAjax, and in your callback function response you can include top.window() function to redirect user to any url you want.
if(!g_user.hasRole("test_role")){
var url = "https://community.servicenow.com/communityid=community_user_profile&user=33b26047db00441823f4a345ca96192a";
top.window.open(url, "_blank");
}
Feel free to mark correct, If I answered your query.
Will be helpful for future visitors looking for similar questions 🙂
Aman Kumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2022 03:54 AM
Hi,
You can take the approach mentioned by Aman i.e. onLoad client script + GlideAjax
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
06-02-2022 03:59 AM
Hi,
You can use the method suggested by Aman using client script with glide ajax and script include.
Or
Try creating one small global UI script as below.
autoRedirect(function() {
if (!g_user.hasRole('role_here') && document.URL.indexOf('sys_id of the record producer') != -1)
{
window.location = 'Give your url here';
}
});
Mark as correct and helpful if it solved your query.
Regards,
Sumanth