Switch views based on values of a field

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2022 06:02 AM
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"
I created a view rule that does that:
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.
Thank you,
Elena

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2022 06:09 AM
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
Aman Kumar

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2022 11:06 PM
Exactly what I thought. Thank you for confirming it. 🙂
Have a nice day,
Elena

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2022 08:48 AM
Feel free to mark correct, If I answered your query.
Will be helpful for future visitors looking for similar questions 🙂
Aman Kumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2022 11:25 PM
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
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader