UI action for cancel flow

AnandKumar1
Tera Expert

Hi All.

When i initiate the Cancel Renewal UI action. I need to bring the info message that, instead of cancelling the renewal do you need to revoke the certificate. If yes, then it should redirect to a catalog which i use. if user click the info message cancel then it should cancel the renewal.

function CheckConfirm() {
    var answer = confirm("Do you want to revoke the certificate? if Yes click Ok. To proceed cancelling the certificate click cancel");

    if (answer != true) {
        alert("answer not true");
        gsftSubmit(null, g_form.getFormElement(), 'cancel_renewal'); 
    } else {
    alert("serviceportal end point");
    }
}
if (typeof window == 'undefined') {
    current.state = 4; /// CAncel the record\
    current.work_notes = "The certificate has been set to cancelled.";
    current.update();
    action.setRedirectURL(current);
    gs.addInfoMessage('cancelled.');
}

 

 

My else condition is not redirecting to the catalog url. However, i checked the alert is working. Am i missing any syntax here?

 

Thanks.

6 REPLIES 6

@AnandKumar1 Okay then , Here's an alternative approach you can try, using g_navigation.navigate:

function CheckConfirm() {
    var answer = confirm("Do you want to revoke the certificate? If Yes, click OK. To proceed with cancelling the certificate, click Cancel");

    if (answer != true) {
        alert("Answer not true");
        gsftSubmit(null, g_form.getFormElement(), 'cancel_renewal'); 
    } else {
        alert("Service portal endpoint");
        g_navigation.navigate("https://test.service-now.com/sp?id=sc_cat_item&sys_id=293403d22b52e100e587593069da1575");
    }
}

if (typeof window == 'undefined') {
    current.state = 4; // Cancel the record
    current.work_notes = "The certificate has been set to cancelled.";
    current.update();
    action.setRedirectURL(current);
    gs.addInfoMessage('Cancelled.');
}

Hi Aniket, Still same.. I think the key is correct, but the redirection is not happening. Should i need to go via any property call?