The CreatorCon Call for Content is officially open! Get started here.

UI Page trigger Processing script

chandukollapart
Tera Contributor

Hi,

I want to create UI page. In that UI page client script want to display confirm dialog box. When users click on "Ok" trigger 

 

 
1 ACCEPTED SOLUTION

Hi,

when you click cancel you are redirecting to new page and form will stay there only

add this

function onCancel() {
var uri = 'home.do';
g_navigation.openPopup(uri);
return false;
}

after processing script is triggered you can redirect to whichever url you want as below

runprocessCode();

function runprocessCode(){

gs.info('Processing script triggered');

// ensure you give valid object for your event queue current won't work here
gs.eventQueue('sendNotification',current, gs.getUserID());

var url = 'your URL here';
response.sendRedirect(url);
}

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.

Regards
Ankur

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

View solution in original post

11 REPLIES 11

palanikumar
Giga Sage
Giga Sage

Hi,

You can use SP Modal in your UI Page. Refer this page for more details:

https://docs.servicenow.com/bundle/kingston-application-development/page/app-store/dev_portal/API_reference/SPModal/concept/SPModal-API.html#SPM-confirm_S

Thank you,
Palani

Thank you,
Palani

chandukollapart
Tera Contributor

Is there any way we can achieve Ok and Cancel functionalities?

HTML:

<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">

<g:ui_form>
        
    </g:ui_form>

</j:jelly>

  

Client script:

var ans = confirm("ATTENTION!! \n\n clicking OK for the to move further.\n\n Click Cancel to move home page.");
if(ans == false){
var uri = 'home.do';
g_navigation.openPopup(uri);
}
else{
runprocessCode();
}

 

function runprocessCode(){
gs.eventQueue('sendNotification',current, gs.getUserID());
}
 
Thanks!