Does anyone know how to pass a value from a UI Page back to a UI Action before running more code afterwards?

Avery Brown
Tera Contributor

Hello, I have a requirement to create popup confirm window with a hyperlink that will be triggered from a UI Action. I've accomplished creating the UI Page. Now where I'm having a problem, is there additional code in the UI Action that needs to run based on the user confirming the first popup window. 

Currently, when the button is clicked, the DialogWindow opens, and the rest of the code runs automatically at the same time. (Which subsequently will open a second dialog window over the first.)

find_real_file.png

1 ACCEPTED SOLUTION

Frank Tate
Giga Guru
Giga Guru

Here's a previous post on a very similar topic. It uses GlideModal() and renderWithContent() to achieve a very similar goal (with a bonus of having all of the HTML for the GlideModal dialog in the script itself, without having to create a separate page).

Frank

View solution in original post

8 REPLIES 8

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

you can call the function defined in UI action from UI page client script like this

myFunction();

Now in the UI Action add this

function myFunction(){

// your lines from 15 onwards which are client side including gsftSubmit if any

}

Regards
Ankur

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

Hi @Ankur Bawiskar ,

 

Could you please help me on how to get return value from UI Page. it is highly important for me.

kindly provide your input : https://www.servicenow.com/community/developer-forum/how-to-use-ui-page-in-onsubmit-client-script/td...

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

Example for OOB

UI Action: Cancel Change

UI Page: change_confirm_cancel

find_real_file.png

find_real_file.png

Regards
Ankur

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

Frank Tate
Giga Guru
Giga Guru

Here's a previous post on a very similar topic. It uses GlideModal() and renderWithContent() to achieve a very similar goal (with a bonus of having all of the HTML for the GlideModal dialog in the script itself, without having to create a separate page).

Frank