How to FORCE a UI View in a module

Katie A
Mega Guru

We have a module on Change > Create New.

I would like to FORCE that module to ALWAYS open the create new form with the default view.

I edited the Application Menu and added the name of the view.

However, it does not work! If the user has another view (such as the approval view) open prior to clicking Create New, it stays with the previous view and does NOT force the default view.

I also tried sysparm_view=default

That did not work either.

How to force the view every time the module is open?

Screen Shot 2016-03-10 at 4.02.22 PM.png

22 REPLIES 22

Yes I used that template:


function sys_userGetViewName() {



if (view.startsWith("my_very"))


{return;}


// do not change view if it starts with sys_ (e.g. sys_ref_list)


if (view.startsWith("sys_"))


{return;}


answer = "my_very_speical_view";


}



function sys_user_listGetViewName() {


sys_userGetViewName();


}


Can you share what YOUR script looked like?


Hi Fuzumbrhan,



I'm facing the same issue.   Could you please share the solution if you successfully found it ?



Thanks,


Amrit


For open tickets, to force users to the view you want you'd need to define


it on the module, then the list forces to that view and the records that


you view BUT the user can amend the view.






For new tickets, if you have a view name that is not default adding the


view name, with underscores for spaces, should do the trick, i.e.



sn_si_incident.do?sys_id=-1&sysparm_query=active=true&sysparm_view=


&sysparm_view_forced=true




Hope that helps


Dave