We're reclaiming inactive PDIs to keep them available for active builders. Learn what's changing, who's affected, and how to protect your work. Read More

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
Tera 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 Accept the solution if it assisted you with your question & Mark this response as Helpful.
Regards
Tanushree Maiti
ServiceNow Technical Architect
LinkedIn: https://www.linkedin.com/in/tanushreemaiti