- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-26-2019 12:32 PM
Hello,
We've a custom table in our custom application.
"New" button in list layout has to be hidden for all the users except "admin".
I tried using "Omit New button" using the followin script but for some reason it's not working.
var userRole=gs.getUser().getRoles();
if(userRole=='admin'){
answer=true;
}
else
answer=false;
Any pointers on this?
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-26-2019 12:39 PM
I think your script is backwards. You want answer to be false if admin role;
answer = ifScript();
function ifScript(){
if(gs.hasRole('admin')){
return false;
}
return true;
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-26-2019 12:39 PM
Hi,
I'd recommend using ACLs for this. Look at your table and the "create" ACL and apply script logic there.
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-26-2019 12:39 PM
I think your script is backwards. You want answer to be false if admin role;
answer = ifScript();
function ifScript(){
if(gs.hasRole('admin')){
return false;
}
return true;
}