How to create a pop up window

anjiadmin
Tera Expert

Popup.PNG

In above picture,I want to make the employee type filed as pop up filed.

How can I achieve that popup shown in the above figure.

Note:

1.Employee type has three values; A,B,None.

2.Before filling the entire form,the employee type field is mandatory to fill.

Thanks,

Y Anjaneyulu

1 ACCEPTED SOLUTION

ramireddy
Mega Guru

You can do this in 2 steps.


1. You need to create a UI page with this layout and functionality.



UI Pages - ServiceNow Wiki



2. Once UI page is defined, using GlideDialogWindow, you can show it as popup.


GlideDialogWindow API Reference - ServiceNow Wiki



Please refer above 2 links, which will help you.


View solution in original post

8 REPLIES 8

ramireddy
Mega Guru

You can do this in 2 steps.


1. You need to create a UI page with this layout and functionality.



UI Pages - ServiceNow Wiki



2. Once UI page is defined, using GlideDialogWindow, you can show it as popup.


GlideDialogWindow API Reference - ServiceNow Wiki



Please refer above 2 links, which will help you.


Thanks Ram reddy.


Do you have any sample code for ui page related to my requirement.



Regards,


Y Anjaneyulu


Create an UI page like below. I gave name as "EmplPopup"



<?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>


  <div>


  Select the employee type :


  <select id="ddlTypes" class="form-control">


  <option>A</option>


  <option>B</option>


  <option>None</option>


  </select>


  </div>


  <p>


  <div>


  <button type="cancel"   value="Cancel"> Cancel </button>


  <button style="margin-left:15px;" type="submit"   value="Ok"> Ok </button>


  </div>


  </p>


  </g:ui_form>


</j:jelly>



Then where ever you want to display this popup, you can call it like below(If it's in SNOW usual forms, in client scripts, you can call like below, If its UI pages, in "client script" section, you need to call below code)



var dialog = new GlideDialogWindow("EmplPopup");


dialog.setSize(400,400);


dialog.setTitle("");


dialog.render(); //Open the dialog



You will get output like below.



Screen Shot 2016-07-13 at 10.38.15 am.png


Hello Ram Reddy,



I have used this in record Producer and is working fine. I am getting popup window with some information on it.



When I am using the same in Service Portal it is not giving me any pop up message. Could you please help me how I need to configure.



Thanks,


Raj