Request Approval UI Action on change form

Aditya2
Kilo Expert

Hi,

I have a requirement where I need to display a confirm message when a user clicks on request approval UI Action.

find_real_file.png

The form should remain on the same page when user clicks CANCEL.

find_real_file.png

I've written a onSubmit Client Script.

find_real_file.png

This is the UI Action.

find_real_file.png

 

Issue is the form is moving to assess even after selecting CANCEL. Can anyone figure out what the exact issue is and suggest appropriate changes.

Thanks

Aditya

1 ACCEPTED SOLUTION

Aditya2
Kilo Expert

The issue was solved.

In client script just set the state as new before returning false as OOB even if script was returning false the state changes to assess on form level.

As the UI Action was OOB I didn't wanted to change it but even that could have worked.

View solution in original post

3 REPLIES 3

Weird
Mega Sage

My guess is that your UI action does its thing and after that your onSubmit script is run, but it doesn't matter anymore.

 

Instead you could just add confirm to the beginning of your UI action and run the script if answer == true?

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

As per your question you want to show confirmation when button is clicked then why not add script to show confirmation there.

Don't use onSubmit client script

Regards
Ankur

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

Aditya2
Kilo Expert

The issue was solved.

In client script just set the state as new before returning false as OOB even if script was returning false the state changes to assess on form level.

As the UI Action was OOB I didn't wanted to change it but even that could have worked.