UI action visibility based on condition
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-16-2024 04:55 AM
Hello,
I need one requirement, the recruitment is when the "abc" user open the incident record if the user have the read access of the record they won't able to see the cancel UI action button, if the user having the write access of the record then they can able to see the cancel ui action,,here i have create the one SI but it's not working any one help on this or can we added into Ui action ?
showResponseTaskButton: function(current, view, type) {
if (view == 'security_itil')
return false;
else if (view == 'nonit_security')
return false;
else if (view == '' && type == 'link')
return false;
else if (view == '' && type == 'context')
return false;
else if (current.active == true && (gs.hasRole('abc') ||gs.hasRole('xyz') || gs.hasRole('')test))
return true;
return false;
},
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-16-2024 05:07 AM
so Cancel should be seen only when the logged in user has WRITE access to the record?
if yes then simply add this in the UI action condition field
Why are you checking role and view etc?
current.canWrite()
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
12-16-2024 05:18 AM
Hi @Ankur Bawiskar ,
yeah i has add the gs.hasRole('abc')&¤t.canWrite() condition even it's not working user who have the both write & read can able see the ui action, if suppose i have write the below code(current.assignment_group.canWrite()😉 it's working ....it's checking the single field when the assignment group is having the write access it's working , having the read access it's not visible .but i need check full record,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-16-2024 05:22 AM
if user has write access through your ACL then it's obvious that your ACL will allow read as well
so simply canWrite() should help
Didn't understand your requirement here
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-16-2024 05:31 AM
Hi @Ankur Bawiskar ,
There is simple requirement, if the user having the "abc" role, then they can able to see the Cancle Ui action if they have the write access of the record, for the same user have the read access then they won't able see the Ui action, that's it. initially i have done this one canWrite() , but it's not working.