We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

How to get the view name of the form by using script

mdsannavulla
Kilo Guru

Hi All,

For change table we are having two different views.So I want to get the view name by using script.

32 REPLIES 32

Excellent,it is working.


Thanks


Hi Kris,



Its working fine on list view but when I am taking the report by setting the query like 'change type = 'itcc'' then it is not showing any records. If I remove the filter then it is showing the records of 'change type ='Infrastructure' only.



Below is the before query Business rule i am using



var transaction = GlideTransaction.get();


var ViewNameIs = transaction.getRequestParameter("sysparm_view");




  if(ViewNameIs == 'itcc_list'){


  current.addQuery("u_change_type", "ITCC");


  }


  else{



  current.addQuery("u_change_type", "Infrastructure");


  }


Hi All,



Any idea on this?


geoffcox
Giga Guru

document.getElementById('sysparm_view').value


The DOM does not contain any element with id=sysparm_view