Applying sysparm_query fitlers to open list from client side ui action

RenukaB
Tera Contributor

Hi All,

 

I am trying to open a List view of table from a Client side UI action while applying the filters using sysparm_query parameter in the url. The list opens correctly , but the filters I'm passing via the url are not being applied, even though they appear in the url string.

6 REPLIES 6

Brad Bowman
Kilo Patron
Kilo Patron

Share your UI Action script using the insert code icon </>

function gotoTestListPage() {
    var gUrl = new GlideURL(window.location.href);

//This is to filter out the Test Cases where execution suite is current sysid. First Url is what I am looking for 
var url = "/sn_test_management_test_list_board.do?sysparm_class_name=sn_test_management_test&sysparm_test_execution_id=" + g_form.getUniqueValue() + "&sysparm_query=u_test_execution_suite!="+g_form.getUniqueValue()+"^ORu_test_execution_suite=NULL&sysparm_stack=no&sysparm_view_name="+ g_form.getViewName();

//var url = "/sn_test_management_test_list_board.do?sysparm_class_name=sn_test_management_test&sysparm_query=number!%3TEMT0001130&sysparm_test_execution_id=0f6e4115935d5690a026fccd1dba1062&sysparm_stack=no&sysparm_view_name="+ g_form.getViewName();
    alert(url);

  //  var url = "/sn_test_management_test_list_board.do?sysparm_class_name=sn_test_management_test&sysparm_test_execution_id=" + g_form.getUniqueValue() + "&sysparm_query=u_test_execution_suite!=" + g_form.getUniqueValue() + "^ORu_test_execution_suite=NULL&sysparm_stack=no&sysparm_view_name=" + g_form.getViewName();

//	/sn_test_management_test_list_board.do?sysparm_class_name=sn_test_management_test&sysparm_test_execution_id=" + '0f6e4115935d5690a026fccd1dba1062' + "&sysparm_query=u_test_execution_suite!=" + '0f6e4115935d5690a026fccd1dba1062' + "^ORu_test_execution_suite=NULL&sysparm_stack=no&sysparm_view_name=" +'Independent'


    if (gUrl.params['sysparm_goto_url']) {
        url += '&sysparm_goto_url=' + gUrl.params['sysparm_goto_url'];
    }
//action.setRedirectURL(url);
    window.location.replace(url);
//  window.location.href = url;
}

I was trying to mock this up, or something similar in my PDI.  I have the sn_test_management_test_list table, but not the board view or whatever this is.  Did you create the board, or is this in a different plugin? If you view the list then manually filter by the same criteria with a hard-coded sys_id, is the URL exactly the same as the URL that resolves from the UI Action? 

Thats the OOB button called Add tests which has the code that i given. There is the URL to redirect. there i just added sysparam_query to filter the records of Tests.