- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-20-2018 04:00 AM
I need to omit the NEW button from a List based on the view.
In one view I want the NEW button to display, in the other I do not.
in a Client Script you can use getView(); that does not work in this condition script.
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-20-2018 04:32 AM
Hi,
you can use the approach of ACL;
open create ACL and in script section have this
answer = determineVisible();
function determineVisible(){
var viewName = '';
var map = gs.action.getGlideURI().getMap();
if (map.get('sysparm_view') != null) {
viewName= map.get('sysparm_view').toString();
if(viewName == 'self_service')
return true; // show new button
else if(viewName == 'xyz')
return false; // hide new button
}
}
Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
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
‎11-20-2018 04:32 AM
Hi,
you can use the approach of ACL;
open create ACL and in script section have this
answer = determineVisible();
function determineVisible(){
var viewName = '';
var map = gs.action.getGlideURI().getMap();
if (map.get('sysparm_view') != null) {
viewName= map.get('sysparm_view').toString();
if(viewName == 'self_service')
return true; // show new button
else if(viewName == 'xyz')
return false; // hide new button
}
}
Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
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
‎03-24-2021 02:27 AM
Hi Ankur,
I have a similar requirement for list view like list view should be read-only for specific view.
i tried your code but its not working as per view.
Regards,
Imam
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-24-2021 02:39 AM
Try adding log statements and check once.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-25-2021 01:41 AM
HI Ankur,
In below code i have added logs but its not getting in system Logs
its getting non-editable to complete table not for the specific view
answer = determineVisible();
function determineVisible(){
var viewName = '';
var map = gs.action.getGlideURI().getMap();
gs.log("map::"+map);
if (map.get('sysparm_view') != null) {
gs.info("inside if::");
viewName= map.get('sysparm_view').toString();
gs.info("viewName::"+viewName);
if(viewName == 'retail_store')
gs.info("viewName1::"+viewName);
return false; // show new button
}
}
Regards,
Imam