How to get the view name of the form by using script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-15-2014 03:41 AM
Hi All,
For change table we are having two different views.So I want to get the view name by using script.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-15-2014 04:11 AM
Client Side
http://wiki.servicenow.com/index.php?title=Client_Scripts
Section 4.8.11 Show or hide an action button depending on the form view
Server Side
http://wiki.servicenow.com/index.php?title=Restrict_Form_Views_by_Role
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-15-2014 04:37 AM
Hi Kalai,
Below is the code I am using for querying different views,but it is not working
if (current.getEncodedQuery().indexOf('sys_id>')== -1)
{
if (current.getEncodedQuery().indexOf('sys_id=') != 0)
{
if(view.startsWith("default"))
{
current.addQuery("u_change_type", "Infrastructure");
}
else if(view.startsWith("itcc"))
{
current.addQuery("u_change_type", "itcc");
}
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-15-2014 04:39 AM
Haven't used it much .. try it on demo and work out something simple first .. if that works well, try to built on it .......
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-18-2015 07:37 AM
The DOM does not contain an element with ID = sysparm_view