Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

get view name from list control omit new condition script

ggg
Giga Guru

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.

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

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

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

10 REPLIES 10

Hey @Ankur Bawiskar you are everywhere. 🙂   I tried this in List control and it worked..