Switch views based on values of a field

Elena Pomana
Tera Guru

Hello,

 

I need to switch between views based on a field on the form.

The task is the following:

  • if field "Test" is choice 1 -> view should be "view 1"
  • if field "Test" is choice 2 -> view should be "view 2"
  • if field "Test" is choice 3 -> view should be "view 3"

find_real_file.png

I created a view rule that does that:

find_real_file.png

The problem is with new records, is it possible to change views in a new record based on the user's choice?

I tried to do the same logic in onChange client script but I need to save the record in order to display a view.

find_real_file.png

 

Thank you,

Elena

6 REPLIES 6

Aman Kumar S
Kilo Patron

Views are decided once the form is rendered, it won't work based onChange of a value on the form, the form has to be refreshed to work, and also it won't work sometimes due to caching issues

 

Best Regards
Aman Kumar

Exactly what I thought. Thank you for confirming it. 🙂

 

Have a nice day,

Elena

Feel free to mark correct, If I answered your query.

Will be helpful for future visitors looking for similar questions 🙂

Best Regards
Aman Kumar

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

you can use onLoad client script to check the field value ans use switchView()

OR

you can use onChange client script and switch the view but remember it would save the form before switching

Regards
Ankur

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