Converting an UI action to show some popup with warning to be shown after click on 'Cancel' button

Deepika54
Tera Contributor

Hi team,

 

We have an OOB UI Action. We need to convert the UI Action so that when someone clicks on the button, it should show a pop up message saying 'Are you sure you want to cancel' with yes or no. if yes is selected, it should perform the activity else it should not do. Kindly help

 

 
 

Screenshot 2026-03-31 171802.png

 
 
 

 

 

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron

@Deepika54 

Client checkbox- checked

onclick - cancelRecord()

something like this in script

function cancelRecord() {
    var confirmValue = confirm('Are you sure you want to cancel');
    if (confirmValue)
        gsftSubmit(null, g_form.getFormElement(), 'cancel');
}

if (typeof window == 'undefined')
    serverCode();

function serverCode() {
    current.status = 'canceled';
    if (new global.ProcurementUtiLs().hasHardwareAssetsForPO(current)) {
        current.asset_operation = ProcurementUtils.ASSET_OPERATIONS.DELETE;

        current.update();
        action.setRedirectURL(current);
    }
}

55.png

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

2 REPLIES 2

Ankur Bawiskar
Tera Patron

@Deepika54 

make the UI action as client side and update the script to use gsftSubmit()

it's an easy requirement

what did you start and where are you stuck?

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

Ankur Bawiskar
Tera Patron

@Deepika54 

Client checkbox- checked

onclick - cancelRecord()

something like this in script

function cancelRecord() {
    var confirmValue = confirm('Are you sure you want to cancel');
    if (confirmValue)
        gsftSubmit(null, g_form.getFormElement(), 'cancel');
}

if (typeof window == 'undefined')
    serverCode();

function serverCode() {
    current.status = 'canceled';
    if (new global.ProcurementUtiLs().hasHardwareAssetsForPO(current)) {
        current.asset_operation = ProcurementUtils.ASSET_OPERATIONS.DELETE;

        current.update();
        action.setRedirectURL(current);
    }
}

55.png

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader