Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

UI Action

kartik110
Kilo Contributor

Hi Everyone,

Need help on the below issue.

I want to create a "New" UI action(list banner button) on sys_user_delegate table that will redirect to a new delegate form. I have used the same code that has been used for global new buttons.But my custom UI action is not working. The below code I have used.

--------action name :-sysverb_new

-------------------------------------------------------------------------------------------------------------

var uri = action.getGlideURI();

var path = uri.getFileFromPath() + '';

path = path.substring(0, path.length - 5) + '.do';

uri.set('sys_id', '-1');

path = checkWizard(uri, path);

if (path)

    action.setRedirectURL(uri.toString(path));

action.setNoPop(true);

function checkWizard(uri, path) {

    var already = uri.get('WIZARD:action');

    if (already == 'follow')

    return null;

   

    var wizID = new Packages.com.glideapp.wizard.WizardIntercept(path).get();

    if (!wizID)

          return path;

   

    uri.set('sysparm_parent', wizID);

    uri.deleteParmameter('sysparm_referring_url');

    uri.deleteMatchingParameter('sysparm_list_');

    uri.deleteMatchingParameter('sysparm_record_');

    uri.deleteParmameter('sys_is_list');

    uri.deleteParmameter('sys_is_related_list');

    uri.deleteParmameter('sys_submitted');

    uri.deleteParmameter('sysparm_checked_items');

    uri.deleteParmameter('sysparm_ref_list_query');

    uri.deleteParmameter('sysparm_current_row');

    uri.set('sysparm_referring_url', uri.toString());

    uri.deleteMatchingParameter('fancy.');

    uri.deleteMatchingParameter('sys_rownum');

    uri.deleteMatchingParameter('sysparm_encoded');

    uri.deleteMatchingParameter('sysparm_query_encoded');

    uri.deleteParmameter('sysparm_refer');

    return 'wizard_view.do';

}

-----------------------------------------------------------------------------------------------------------------------------------------

Can anyone help me with this issue? or any other way I can achieve this. I have also used action.setRedirectURL(/sys_user_delegate.do?sys_id = -1);

But still the button is not working.Any suggestions highly appreciated.

Thanks,

Kartik

5 REPLIES 5

venkatrajesh
Tera Expert

This works in server side script of Ui Action.


Please move this to server side script and validate.