
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-13-2021 07:07 PM
Hi all! Looking for help w/ an Advanced View Rule (seems it has to be advanced, from what I've seen) such that if a user starts a new record in the Change Request table, the view defaults to the "Default view". (Our issue is very similar to this, but I'm not finding a viable answer there or elsewhere.)
A friend told me about View Rules and helped me create one, but it has no conditions. Really the only condition I have is that the record showing is a new record (i.e., if the URL contains 'sys_id=-1'). We don't want to force the view if the user pulls up an existing record, primarily because I don't have a good reason to do that--the problem is limited to new records. 🙂
I'm brand-spanking-new to GlideURI and don't have a handle on it yet. I expect that's what I'll need, but am not sure how to set it up in the Advanced Script. The latest version of what I've tried is below (not working).
(function overrideView(view, is_list) {
var url = gs.action.getGlideURI().getMap();
var sysId = url.get('sys_id');
if (sysId === -1) {
answer = ''; // set the new view to answer
}
})(view, is_list);
Thanks in advance for any help here. Let me know if more details are needed.
Thanks!
Solved! Go to Solution.
- Labels:
-
User Interface (UI)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-13-2021 09:21 PM
HI Aaron,
I tried on Incident table and it worked for me, here are the screens,
view rule
you can also do sysid is empty
Incident record

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-13-2021 09:21 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-13-2021 10:04 PM
Hi,
Instead you can use current.isNewRecord() to check whether it is new record or existing one.
(function overrideView(view, is_list) {
if (current.isNewRecord()) {
answer = ''; // set the new view to answer
}
})(view, is_list);
Thanks,
Anil Lande
Thanks
Anil Lande

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-23-2021 01:57 AM
non advanced with condition "sys_id is undefined" seems to work for me as well