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

Neha79
ServiceNow Employee
ServiceNow Employee

and im using onchange clientscript

Hi Neha,

if you are in custom scope app then please give the complete endpoint of the UI page in the GlideDialogWindow

find_real_file.png

Regards
Ankur

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

Thanks! that worked.

can you help me with retrieving the button value in processing script? Im setting the value in client script.

I tried logging but dint get any log.

<button class="btn btn-primary" id="send_button" onclick="sendAction()" style="min-width: 5em;" title="" type="submit">
Send
</button>

In processing script:
function sendAction(){

gs.info(send_button);

}

Glad to know it worked.

the processing script would execute only when you use <g:ui_form> tag in HTML.

what value you want in the processing script?

please explain the requirement with UI page screenshot

Regards
Ankur

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

Hi,

This is how i have been trying to get the element value in processing script but its not working. 

if(cancel_project_button == 'cancel_project'){
gs.info("cancel project called");

//send notification
}