need to display popup

suresh kaliappa
Tera Expert

Hi all

I have a requirement to display popup message with Yes and No button in workspace view. I used the following code. i can able to see confirmation yes and No button. But label was not displaying. so, requesting someone assistance in this. 

 

function onClick(g_form) {
   g_modal.showFields({
        title: 'confirmation',
        confirmTitle: 'Yes',
        cancelTitle: 'No',
        fields: [{
            type: 'label',
            placeholder: 'Are you sure you want to proceed?'
        }]
    }).then(

        function() {

            // YES clicked 
            g_form.setValue('state', '7');
            g_form.save();

        },

        function() {

            // NO clicked
            // No action required

        }

    );

}
1 REPLY 1

Tanushree Maiti
Giga Patron

Hi @suresh kaliappa 

 

Try with this :

 

function onClick() {

    g_modal.confirm(

        'Confirmation',

        'Are you sure you want to cancel this incident?',

        function(confirmed) {

            if (confirmed) {

                g_form.setValue('state', '7');

                g_form.save();

            }

        }, {

            "cancelTitle": "No",

            "confirmTitle": "Yes"

        });

    return false;

}

 

Reference: https://www.servicenow.com/docs/r/api-reference/g_modalClientAPINX.html

https://www.servicenow.com/community/developer-forum/workspace-yes-and-no-popup/m-p/3442253

 

 

Please mark this response as Helpful & Accept it as solution if it assisted you with your question.
Regards
Tanushree Maiti
ServiceNow Technical Architect
Linkedin: