View rule script not working

Apaul
Tera Contributor

Can anyone help me to fix this code?
If Knowledge base is IT then the article view should be people zone view or else it should be default view.

AnkkushPaul_0-1748530778325.png

 

1 ACCEPTED SOLUTION

Nishant8
Giga Sage

Hello @Apaul , current is not accessible here. you can simply build the condition using condition builder as below.

you can click on the 'Show Related Fields' to dot walk to 'knowledge base fields'.

Nishant8_0-1748533500455.png

 

Regards,

Nishant

View solution in original post

5 REPLIES 5

Juhi Poddar
Kilo Patron

Hello @Apaul 

You can use switchView() method if it is needed to switch the view using script on client side.

Syntax:

switchView('section', 'table_name', 'view_name');

Here table_name and view_name is the backend name.

Example:

    var view = g_form.getParameter('sysparm_view');
    var newValue = g_form.getValue('urgency');
    if (view != 'ess' && newValue == 1) {
        // Switch to the desired view (e.g., 'ess')
        switchView('section', 'incident', 'ess');
    }

Hope this helps!

 

"If you found my answer helpful, please like and mark it as an "accepted solution". It helps future readers to locate the solution easily and supports the community!"

 

Thank You
Juhi Poddar