UI Action visible on List ('List Banner Button' using action.setRedirectURL?

klautrup
Kilo Expert

Hi,
I have a 'Client' UI Action with this script:

function createLogTechComp(){

gsftSubmit(null, g_form.getFormElement(), 'sysverb_propose_new_logical_tech_comp');

}

if(typeof window == 'undefined') {

var item = 'c48b73f03749738005d41a7943990e8b';
var url = 'com.glideapp.servicecatalog_cat_item_view.do?sysparm_id=' + item +'';

action.setRedirectURL(url);
}

 

If set as a 'Form button' as expected it redirects to the Catalog Item.

However, if I change it to a 'List Banner Button' nothing happens.

How do I get a UI Action set to 'List Banner Button' to redirect?
Can't I use action.setRedirectURL ?

1 ACCEPTED SOLUTION

Tim Deniston
Mega Sage
Mega Sage

Is there a particular reason you have Client checked? g_form doesn't exist on a list view, so any part of the client side scripting will fail. It's probably never getting to the server side (check your browser console to verify). 

If you just put the server side in the script and uncheck Client, it should work. 

var item = '38c1fc840a0a0b2700285921c2bf5fc8';
var url = 'com.glideapp.servicecatalog_cat_item_view.do?sysparm_id=' + item +'';

action.setRedirectURL(url);

 

Note: Normally, there is a message that appears when you don't have any records selected that would say something like "no records selected." This is suppressed when your UI Action name starts with "sysverb_" but it looks like you have already addressed that aspect. 

View solution in original post

1 REPLY 1

Tim Deniston
Mega Sage
Mega Sage

Is there a particular reason you have Client checked? g_form doesn't exist on a list view, so any part of the client side scripting will fail. It's probably never getting to the server side (check your browser console to verify). 

If you just put the server side in the script and uncheck Client, it should work. 

var item = '38c1fc840a0a0b2700285921c2bf5fc8';
var url = 'com.glideapp.servicecatalog_cat_item_view.do?sysparm_id=' + item +'';

action.setRedirectURL(url);

 

Note: Normally, there is a message that appears when you don't have any records selected that would say something like "no records selected." This is suppressed when your UI Action name starts with "sysverb_" but it looks like you have already addressed that aspect.