- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-02-2025 01:44 AM - edited ‎04-02-2025 03:12 AM
In portal, for a page under the "Can View" section, I mapped a user criteria for it.. and I used advance scripting over there.. and while testing I don't see logs are getting generated.. can anyone please help me to understand on why LOGS are not getting Generated? It makes me feel like user criteria it's self is not working..
answer = AccessValidation();
function AccessValidation() {
var UserID = gs.getUserName();
gs.info("Sathwik Entered");
var gr = new GlideRecord('sys_user');
gr.addEncodedQuery('user_name=' + UserID');
gr.query();
if (gr.next()) {
gs.info("Sathwik found");
return true;
} else {
gs.info("Sathwik not found");
return false;
}
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-02-2025 01:52 AM
where did you add that? share screenshot
try this script
answer = AccessValidation();
function AccessValidation() {
var gr = new GlideRecord('sys_user');
gr.addEncodedQuery('sys_id=' + user_id);
gr.query();
if (gr.next()) {
gs.info("Sathwik found");
return true;
} else {
gs.info("Sathwik not found");
return false;
}
}
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-02-2025 02:14 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-02-2025 02:22 AM
at first place is the script being evaluated from ServiceNow -> please confirm this
if not then there's no point in further discussion
try to add simple log and see if that comes
Also is that related list OOB one or custom one?
I could not see this related list when I configured the form for Portal page record (sp_page)
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-02-2025 02:50 AM
It's working when we use "Group" but advance scripting is not working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-02-2025 02:54 AM
share the complete user criteria screenshot and also what's your business requirement.
to whom it should be seen
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-02-2025 04:53 AM
@Ankur Bawiskar Just realised that, there was some issue with impersonation..
when I clear cache everytime, it was working as expected.