How to check view in business rule
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-17-2016 05:18 PM
Hi: I have a business rule that I only want to run on a specific view. Anyone know how to do a view check in a business rule? Thanks! Rita

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-17-2016 05:56 PM
Rita,
Business rules are not linked to the form, So there is no Out of Box functionality that can get you a view in a business rule. But you can go through this thread, you will find a work around.
How do I get name of the view that submitted the form inside a business rule
Thanks,
Abhinay
PS: Hit like, Helpful or Correct depending on the impact of the response
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-17-2016 09:06 PM
Hi Rita,
As stated by Abhinay Business Rules are not view specific but you can do few tricks.
1) View run on View rules so the type of condition you have specified in View Rules you can check for same conditions and if they are true run your business rule.
2) You can use DOM to look for view name and if found run your Business Rule.
Thanks ,
Rajeev
PS: Hit like, Helpful or Correct depending on the impact of the response

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-17-2016 10:58 PM
Hi Rita,
Below code snippet should help you
var view_name='';
if (gs.getSession().isInteractive()) {
var map = gs.action.getGlideURI().getMap();
if (map.get('sysparm_view') != null) {
view_name= map.get('sysparm_view').toString();
}
}
gs.log('View: '+view_name);
Thanks
Abhinandan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-18-2016 06:03 AM
Hi Abhinandan: Your code worked beautifully in the business rule! I also want to change the view in the business rule to blank after the lookup. I tried:
map.set('sysparm_view', '');
but that didn't seem to work. Any idea?
Thank you all! Rita