- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-05-2022 08:23 AM
I'm trying to get a record producer on our portal to only be visible to certain users according to a new field on the user form, which is 'u_authorised'. I'm trying to do this via the 'Available for' list on the record producer and have created a new user_criteria record which is using the below script in the advanced script option of the user_criteria record. I've tried a few different variations on this but the record won't show.... anybody have an idea what I'm doing wrong?
=====================
getAuth();
function getAuth() {
var user = new GlideRecord('sys_user');
user.get(gs.getUserID());
If(user.u_authorised == 'true'); {
return true;
}
}
=====================
1: Record producer shows for all users on the portal when the 'Available for' list isn't populated.
2: When I add the user_criteria of 'Any User' to the 'Available for' option of the record producer it shows fine, so visibility is fine until I add this new custom user_criteria option instead of the 'Any User' criteria.
3: I tried adding an else option to return false immediately after the 'return true' but I get an unexpected token error when adding that in.
Many thanks in advance for any input!
Solved! Go to Solution.
- Labels:
-
Request Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-05-2022 12:26 PM
hey
getAuth();
function getAuth() {
var user = new GlideRecord('sys_user');
user.get(gs.getUserID());
if(user.u_authorised == 'true' || user.u_authorised == true ) {
answer= true;
}
else
{
answer=false;
}
}
try this
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-05-2022 08:56 AM
hello
getAuth();
function getAuth() {
var user = new GlideRecord('sys_user');
user.get(gs.getUserID());
If(user.u_authorised == 'true' ||user.u_authorised == true ) {
answer= true;
}
else
{
answer=false;
}
}
Hope this helps
please mark my answer correct if this helps you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-05-2022 11:27 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-05-2022 12:26 PM
hey
getAuth();
function getAuth() {
var user = new GlideRecord('sys_user');
user.get(gs.getUserID());
if(user.u_authorised == 'true' || user.u_authorised == true ) {
answer= true;
}
else
{
answer=false;
}
}
try this
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-05-2022 02:38 PM
Hey