Adding an acknowledgement check box in the Confirmation message displayed via Catalog client script

Shantanu Mishra
Tera Contributor

Hi Experts!

 

I have a Catalog client script that displays a confirmation message displaying the Catalog variables like below:

 

ShantanuMishra_0-1716380675395.png

I need a add an acknowledgement check box in the above message that requires users to check before proceeding (They need to make sure the checkbox is ticket prior selecting "Ok").

 

Below is my On submit Catalog client script:

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

function onSubmit() {
    // Retrieve the values of the specified fields
    var startDateTime = g_form.getValue('start_date_time');
    var endDateTime = g_form.getValue('end_date_time');
    var recurrence = g_form.getValue('recurrence');
    var timeZone = g_form.getValue('time_zone');
    var recurEvery = g_form.getValue('recur_every');
    var frequency = g_form.getValue('frequency');

    var confirmationMessage = 'Please review the below selected information';
    if (recurrence === "Once") {
        confirmationMessage += ' for a single event.\n' +
                               'Click OK to continue or Cancel to return to the form.\n' +
                               'Start Date Time: ' + startDateTime + '\n' +
                               'End Date Time: ' + endDateTime + '\n' +
                               'Recurrence: ' + recurrence + '\n' +
                               'Time Zone: ' + timeZone;
    } else {
        confirmationMessage += ' for recurrence.\n' +
                               'Click OK to continue or Cancel to return to the form.\n' +
                               'Start Date Time: ' + startDateTime + '\n' +
                               'End Date Time: ' + endDateTime + '\n' +
                               'Recurrence: ' + recurrence + '\n' +
                               'Time Zone: ' + timeZone + '\n' +
                               'Recurrence Every: ' + recurEvery + '\n' +
                               'Frequency: ' + frequency;
    }

    // Display the confirmation dialog
    var answer = confirm(confirmationMessage);

    // If the user clicks "Cancel", prevent the form submission
    if (!answer) {
        return false;
    }
}
 
-------------------------------------------------------------------------------------------------------------------------------------
Any assistance will be greatly appreciated.
 
Thanks,
Shantanu
1 REPLY 1

HS4
Tera Expert

Hi @Shantanu Mishra ,

 

You could use a GlideModal API here, pair it up with a custom UI page. This page would contain your HTML stuff like a checkbox and text.

 

Refer to the below pages for more details on GlideModal API-

https://developer.servicenow.com/dev.do#!/reference/api/utah/client/c_GlideModalClientSideV3API

 

https://docs.servicenow.com/bundle/washingtondc-api-reference/page/app-store/dev_portal/API_referenc...

 

If my answer helped you in any way, please then mark it as helpful or correct.

 

Thanks,