New form is not opening on the custom table, when we click on the new Button

SaiRoshiniB
Tera Contributor

Hello all,

 

I have a requirement to create a confirmation pop up, when we click on the New ui action, 

i have created the separate ui action on the custom tale and i have added the pop up on the list view.

Now, i'm getting the popup with to action on that  as "OK" and "Cancel".

i have wrote the script as if we click on the ok then it needs to open the form and if we click on the cancel it needs to abort the action.

 

please find the below code that i have used on the new button:

var answer = '';

function requestDocument() {
    answer = confirm("Are you sure you want to send this Request Document?");
    alert('e the function ' + answer);


    if (answer == true) {
        alert('inside the if loop');
        //gsftSubmit(null, g_form.getFormElement(), '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);
    }
    else{
        action.setNoPop(false);
    }
}


function checkWizard(uri, path) {
    var already = uri.get('WIZARD:action');
    if (already != null) {
        return null;
    }
    var wizID = new GlideappWizardIntercept(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';
}
kindly check and provide your help.
 
Thanks in advance
 
0 REPLIES 0