- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-24-2021 05:30 AM
here we have ritm records which needs to hide if the user is not part of "IT" team.
we tried to hide through ACL but not working as expected , field are getting hide but not the complete record.
here the ACL for reference:
if(gs.getUser().isMemberOf("IT")){
answer =true;
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-24-2021 09:51 PM
Hi,
Okay so you want this
1) if user is member of IT then show records where u_hr=true
2) if user is not member of IT then show records where u_hr=false
then update the BR as this
Condition: gs.getSession().isInteractive()
Script:
(function executeRule(current, previous /*null when async*/ ) {
// Add your code here
if(gs.getUser().isMemberOf("IT"))
current.addEncodedQuery("u_hr=true");
else
current.addEncodedQuery("u_hr=false");
})(current, previous);
Let me know if I have answered your question.
If so, please mark appropriate response as correct & helpful so that this thread can be closed and others can be benefited by this.
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-24-2021 07:44 AM
we have checkbox field (HR) in RITM form, once the ritm created with HR checkbox is true then that record only has to show only when the logged in user belongs to IT group,
if not the record has to hide
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-24-2021 07:49 AM
Hi,
then update query BR script as this
current.addEncodedQuery("u_hr=true");
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-24-2021 08:09 AM
if one user who is not part of IT group is logged in , then the records which is "u_hr = true" should not show, but other ritm's has to show in list view and as well as form view.
but when i implement the above solution, it is completely restriction the list view to normal user
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-24-2021 09:51 PM
Hi,
Okay so you want this
1) if user is member of IT then show records where u_hr=true
2) if user is not member of IT then show records where u_hr=false
then update the BR as this
Condition: gs.getSession().isInteractive()
Script:
(function executeRule(current, previous /*null when async*/ ) {
// Add your code here
if(gs.getUser().isMemberOf("IT"))
current.addEncodedQuery("u_hr=true");
else
current.addEncodedQuery("u_hr=false");
})(current, previous);
Let me know if I have answered your question.
If so, please mark appropriate response as correct & helpful so that this thread can be closed and others can be benefited by this.
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
‎01-28-2022 06:37 AM
Hope you are doing good.
Did my reply answer your question?
If my response helped you please mark it correct to close the question so that it benefits future readers as well.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader