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

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

Apaul
Tera Contributor

I know i can do it, but i want to go with script as there are multiple conditions which needs to be satisfied. this is one of them. If i go with simple conditions instead of script, i might need to go with 4 or 5 rules.

Ankur Bawiskar
Tera Patron
Tera Patron

@Apaul 

view rule runs before the list/form is loaded and hence it doesn't have access to current object

For your requirement you will have to create multiple view rules based on unique conditions.

Also check this link which talks about the workaround

The "current" object is not available in Advanced View Rule scripts although selectable in the scrip... 

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@Apaul 

Did my reply answer your question?

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader