Forced view in UI View rule - advanced mode script

Domi727
Tera Contributor

I have a UI View Role. Unfortunately, in Advanced mode, I could not solve the problem of not being able to change the view.

Domi727_0-1709304462877.png

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?

0 REPLIES 0