Can i change request form view based on field value?

Rakhi1
Kilo Contributor

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.

10 REPLIES 10

From that screen, are you able to pull down the context menu and change views?


Yes Chuck... i am able to change views from this screen.


If you can change views manually, that verifies that the view rule is not working.



I feel like I'm missing something obvious. It's not this hard to set up a view rule.


Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Abhinay Erra
Giga Sage

use window.open("your url goes here","_self");