View based on URL/URI
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-23-2011 03:33 PM
I have been struggling to implement a solution for dynamically loading views for Incident records. The qualifier is basically the URI/URL.
New Records
View: New
Existing Records+After clicking save on a new record
View: Default
Within the CMS
View: ess
Any suggestions on how to accomplish this?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-23-2011 05:04 PM
Are you using the Create New module or the New "button" on the list?
If the module, then simply force the view using the
in the URL Arguments.
sysparm_view=
For CMS this could be just as simple, too.
For instance:
https://demo.service-now.com/incident.do?sys_id=-1&sysparm_view=ess
https://demo.service-now.com/incident.do?sys_id=-1&sysparm_view=
If not, then this old wiki article may be a start to get you on your way. If you can find a way to gather the state of the form inside this funciton:
Restrict_Form_Views_by_Role
PS - Global Business Rules are "bad" technically speaking, and should be avoided whenever possible. However, I think this is one case where they are unavoidable.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-23-2011 05:06 PM
Everything works great, except for one saving the record. I can specify the view in both the CMS and Create New URL's, but when clicking save, the view sticks with the new view.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-23-2011 05:55 PM
gaidem
After a bit of "hacking" against that old idea of the [table]GetViewName function idea in my previously referenced Wiki Article, I found the
object. That's a start.
gs.action
I ran this as a Global BR to figure out what is available. If you find an object, dot-walk to it to find more like I did to learn more about gs.action. I'm sure there is something possibly helpful inside of that object??
function incidentGetViewName() {
var prefix = '>>>TESTING: ';
for(var x in gs) { gs.log(prefix + x); }
for(var x in gs.action) { gs.log(prefix + x); }
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-23-2011 06:57 PM
Wow, this was extremely helpful! Thank you!
So much to explore, I will take a look at this in the AM.