business rule to detect form view or list view?
This content was last updated in 2019. It may still be useful, but could contain outdated information. Please confirm its accuracy before relying on it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2017 09:01 PM
Hi folks,
Is it possible to detect in a business rule whether a change is made via a form view or list view? building a business rule, in list view, I want the job number to be shown, but not in form view as the number is always displayed.
Thanks in advance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2017 09:24 PM
Well there is a method to get view serverside
Re: HHow to get list view name in script include
I believe that GlideUri should also consist of URL and indexOf('_list') != -1 should provide you with list views.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-17-2017 09:02 AM
Hello George,
I had a similar situation where I need to detect if a UI Action is fired from List Context or Form. So I came up with below script to check and perform actions based on it:
gURI = action.getGlideURI();
var isList = gURI.get('sys_is_list');
var isRelList = gURI.get('sys_is_related_list');
if(!isList && !isRelList){
perform form actions; //only if UI Action is fired from form view
}else{
perform list actions; //only if UI Action is fired from list or related list
}
I did not try it in Business rule but I think it should still work.
Give it a try and let me know.
Regards,
Santhosh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2019 07:16 AM
In BR this worked for me.
if (gs.action.getGlideURI().toString().indexOf("xmlhttp.do") == 0) {
// updated from list
}
else {
// updated from form
}