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

I tried this already it is not working.


It is not going to that view loop


When you think about it, view is not saved in the database, it is just a clinet component and hence you cannot get the view in server side scripting.



Workaround:



Step 1: Create a text type field on the form/table that will store the view


Create an onSubmit Client script on the table and use the below code(Replace feild_name with the variable name )



var view = g_form.getParameter('view');


if(view == ''){ // for default view this will return an empty string


        view = 'default';


}


g_form.setValue('field_name',   view);




Step 2:


in your Business Rule you can use this variable to add conditions to your query.


  if(current.feild_name == "default")     {


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


  }   else if(current.feild_name == "itcc")       {


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


  }



This should work .



Hope that helps !


I tried this in same way by using a differentiation filed for two views



We are having one common differentiation field for two views by using that tried in BR but it is not working


What are you trying to achieve?


Can you elaborate your requirement?


actually we are having two views for change request table and fields are different in two views.



So we created two modules for checking all change requests for two different views



In first module I want to show default view changes---for this I want to put a default filter and that should not editable



In second module   I want to show 'itcc' view changes -- for this I want to put a default filter and that should not editable