Running modal in workspace form

MaharshiC
Tera Contributor

Hi,

 

Is it possible to run a modal after submitting a form in custom workspace? Some Example script will help. Also is it possible to redirect user to some other page using the modal?

 

 

1 ACCEPTED SOLUTION

@MaharshiC 

why not open that in new tab so that form gets saved and the tab is also opened?

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

View solution in original post

7 REPLIES 7

@MaharshiC 

yes you can use g_modal and show button and then redirect

but why not use confirm box and then redirect?

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

Hi @Ankur Bawiskar ,

This is the script I used - 

But I want the form to get saved first and then do the redirection. Is it possible to run the entire thing after saving form

function onSubmit() {
   //Type appropriate comment here, and begin script below
   var answer = confirm('Record saved successfully');
    if (answer) {
        var redirectURL = 'https://www.google.com/'; //url to redirect; this approach works in platform and Service Portal view
        top.window.location = redirectURL;
	}
   
}

 

@MaharshiC 

why not open that in new tab so that form gets saved and the tab is also opened?

If my response helped please mark it correct and close the thread so that it benefits future readers.

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