I have a UI View Rule. Unfortunately, in Advanced mode, I could not solve the problem of not being able to change the view.
My script:
(function overrideView(view, is_list) {
if (is_list) return;
var url = gs.action.getGlideURI().getMap();
var sysId = url.get('sys_id');
//access the GlideRecord of the currently viewed record
var gr = new GlideRecord('incident');
gr.get(sysId);
if (gr.company == "xyz") {
if (url.get('sysparm_view') == "xyz" && gs.hasRole("xyz")) {
answer = 'xyz';
} else {
answer = 'xyz';
}
} else {
answer = 'xyz';
}
})(view, is_list);
What is the simplest solution to make the view unchangeable?
Unfortunately, I could not find a way to disable view switching in advanced mode.
