can we confirm field message on the catalog form

madhusagar
Tera Contributor

Hi Team,

 

I have a requirement in the catalog form, if the Requested For user is identified as an external user, we need to display a confirmation message under the requested for field asking the user to confirm by selecting "Yes" or "No".

Could you please confirm whether this is achievable?

 

 

As per my understanding, standard field messages in servicenow can only display informational, warning or error text and do not support interactive buttons like Yes/No directly under the field. If confirmation is required, we may need to use a client-side confirmation dialog or modal popup and handle the user response accordingly through a client script.

 

Please let me know the recommended approach and if you can share a working example.

 

Thanks  

Thanks & Regards,

Madhu.

3 REPLIES 3

Ankur Bawiskar
Tera Patron

@madhusagar 

how are you determining if user is external or not?

it's possible to show Yes/No with spModal in portal side

spModal won't work in native

see this and enhance your onChange catalog client script

 

spModal.open({

        title: 'Attachment recommended',

        message: 'You mentioned an error occurred, if possible please attach a screenshot of the error',

        buttons: [{

            label: 'Okay',

            value: 'agree',

            primary: true // Makes this button visually prominent

        }, {

            label: 'Cancel',

            value: 'disagree'

        }]

    }).then(function(result) {

        // This function executes when a button is clicked

        if (!result.primary) {

            return true;

        } else {

            g_form.addInfoMessage("Submit");

            return true;

        }

    });

 

AnkurBawiskar_0-1771512819411.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  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

GlideFather
Tera Patron

Hi @madhusagar,

 

a field message can be added via Catalog UI Policy or Catalog client script g_form.showFieldMsg('field_name', 'YOur message here.');

 

But if you want this yes/no checkbox be visible then you need to create a new variable. The field message can be text only.

_____
100 % GlideFather experience and 0 % generative AI

Tanushree Maiti
Mega Sage

Hi @madhusagar ,

I will Suggest to go for Onchange client script on Requestedfor  with confirm() function in conjunction with getMessage() for a basic confirmation pop-up that returns true for "OK" and false for "Cancel".

 

 To have "Yes" and "No" buttons and better styling and you want to give effort, it is recommended to use GlideModal or create a custom UI Page.

Ref sample code for glidemodal : Confirmation Dialog Box using UI Page, OK Button w... - ServiceNow Community

 

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