Can i change request form view based on field value?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-26-2016 11:02 AM
Hi,
I need to change my req form view based on one field value. If the field value is true, need to change the form view. Based on that, created view rule. But it is not working.
Tried with client script...
function onLoad() {
var catlogitem = g_form.getValue('u_catalog_item_request');
if(catlogitem=='true')
{
var sys_id = g_form.getUniqueValue();
var url = 'sc_request.do?sys_id=';
url += sys_id;
url += '&sysparm_view=service_catalog&sysparm_view=service_catalog&sysparm_domain=null&sysparm_domain_scope=null&sysparm_record_row=4&sysparm_record_rows=2515546&sysparm_record_list=ORDERBYDESCnumber&sysparm_nostack=yes';
top.window.location = url;
}
}
Some how it is working but it opens a new page...because of that, nav menu, banner will not appear. I want to be on same page...and need to change form view.
I am using fuji.
Can anyone help me on this...Thanks in advance.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-26-2016 11:04 AM
Hi Rakesh,
Views were not meant to be changed dynamically (onLoad counts). The view rule contains the conditions of what view is used and when.
BTW, you have sysparm_view in your URL twice.
PS: If a view rule is in place and conditions match, then the sysparm_view doesn't count.
Reference:
View Management - ServiceNow Wiki
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-26-2016 11:23 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-26-2016 11:27 AM
Thank you Rakesh!
Can you show me the form layout for the view called 'service_catalog' please?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-26-2016 11:51 AM