business rule to detect form view or list view?

georgechen
Kilo Guru

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.

3 REPLIES 3

Gurpreet07
Mega Sage

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.


santhoshaitha
Kilo Expert

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


Christian Engs2
Giga Contributor

In BR this worked for me.

 

if (gs.action.getGlideURI().toString().indexOf("xmlhttp.do") == 0) {

  // updated from list

}

else {

  // updated from form

}