Display custom dialog box

Neha79
ServiceNow Employee
ServiceNow Employee

Hi,
I have a dropdown field "status" on my form and im looking for a way to create a dialog box with three options "cancel", "cancel but dont send" , "send". When a user changes a status to cancel, this dialog box should appear with these three options and when user clicks on send, a notification should be sent. When 'cancel but dont send' is selected then status will be updated. I dont have much knowledge on UI page scripting. Can anyone help me to achieve this functionality?
Thanks in advance!

1 ACCEPTED SOLUTION

Hi Neha,

I don't think directly you can use "cancel_project_button" in processing script

only html hidden element id's can be access directly in processing script

please update code as below

HTML:

After line 4 add this line

<input type="hidden" id="hiddenElement" name="hiddenElement"/>

in client script make this change for both the functions

Client Script:

after line 6 add this

gel("hiddenElement").value = 'cancel clicked';

after line 11 add this

gel("hiddenElement").value = 'send clicked';

now in processing script check this

Processing script:

if(hiddenElement == 'cancel clicked'){
gs.info("cancel project called");

//send notification
}

else{

gs.info('send button clicked');

}

Regards
Ankur

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

View solution in original post

13 REPLIES 13

Hi Neha,

I don't think directly you can use "cancel_project_button" in processing script

only html hidden element id's can be access directly in processing script

please update code as below

HTML:

After line 4 add this line

<input type="hidden" id="hiddenElement" name="hiddenElement"/>

in client script make this change for both the functions

Client Script:

after line 6 add this

gel("hiddenElement").value = 'cancel clicked';

after line 11 add this

gel("hiddenElement").value = 'send clicked';

now in processing script check this

Processing script:

if(hiddenElement == 'cancel clicked'){
gs.info("cancel project called");

//send notification
}

else{

gs.info('send button clicked');

}

Regards
Ankur

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

Hi Neha,

Hope you are doing good.

Let me know if I have answered your question.

If so, please mark appropriate response as correct & helpful so that this thread can be closed and others can be benefited by this.

If not, please let us know if you need some more assistance.

Regards
Ankur

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

AbhishekGardade
Giga Sage

Hello Neha,

Have a look on below blog:

Custom Glide Modal Dialog Boxes

SweetAlert

Please mark as Correct Answer and Helpful, if applicable.
Thank You!
Abhishek Gardade

Thank you,
Abhishek Gardade

Hi,

I have created a UI page with name 'cancel_action' and im calling it from client script but the UI page is not rendering. can you suggest what the issue could be?

script:
var dialog = new GlideDialogWindow("cancel_action");
dialog.setTitle("Send Notification");
dialog.setSize(550, 500);
dialog.render();