Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Confirm popup box on Portal

Sam Ogden
Tera Guru

Hi All,

I'm trying to add a confirm box on a record producer for our service portal.   I've got the below code, when I go through the 'try it' button the confirm box appears, but regardless of if I select 'ok' or cancel it still submits the record.   I need it to only submit if 'ok' is selected and to return to the form if 'cancel' is selected.  

My other issue is when I tried to run this by logging into the portal when I clicked submit on my form the confirm box never appeared?

find_real_file.png

Any help is greatly appreciated.

Thanks

1 ACCEPTED SOLUTION

Chris M3
Tera Guru

I haven't done anything in the service portal, but I believe you need to return the confirm response



so


function onSubmit() {


      return confirm("Please confirm");


}


View solution in original post

7 REPLIES 7

Chris M3
Tera Guru

I haven't done anything in the service portal, but I believe you need to return the confirm response



so


function onSubmit() {


      return confirm("Please confirm");


}


Hi Chris,



Thanks for the quick response.   That has worked and now returns to form if cancel is selected.



I still have the issue however where this is working when I go through the 'try it button, but if I actually log into the portal it is not working any suggestions?



Thanks


That's unfortunately where I can't help you yet.   From my understanding client scripts work completely different in the Portal, but we have not started our Portal implementation and I've only glanced at it a few times.


After a bit of playing around I've managed to get it to work on the portal.   It appears to be the UI type field that I had set to desktop.   Once I changed this to both it then worked on the portal for me.   Cheers for your help with the code earlier.