Popup window
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2016 10:26 PM
Hi All,
I have a requirement that a popup window to come when a dropdown value is selected as "other" with a link side the popup window.
Can anyone please help me with this.
Thanks,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2016 10:42 PM
Create a OnChange Client Script for your field.
Use the following code there...
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var Selection = g_form.getValue('your field name');
if (Selection == 'other') {
alert('Desired Link and text you paste here');
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2016 10:57 PM
Hi Ashish,
I dont want an alert, i need a popup window and a link in that popup window.
Thanks,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2016 11:01 PM
Try this one out
GlideDialogWindow: Advanced Popups Using UI Pages - ServiceNow Gu
Please hit like or mark helpful if found appropriate
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-21-2016 03:16 AM
Hi Ankita,
Nice to know that you have this requirement. As a developer it feels good to implement these kind of real time scenarios. So let me brief you :
Make an OnChange client script according to the drop down value you have mentioned. When the value is "Other" just call a Dialog Window from your client script.
The Dialog window (or say Pop-up) you have called in your CS needs to be designed in UI Pages. Very simple. Just hear me through.
For example I have this :
Step 1 : Client script :
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading) {
return;
}
var callback = function() {
g_form.setValue("live_feed", true);
};
//Type appropriate comment here, and begin script below
if (oldValue == "true" && g_form.getValue("live_feed") == "false") {
var dialog = new GlideDialogWindow('glide_confirm_standard'); // 'glide_confirm_standard' is the UI page called which has the shape & content of the pop-up
dialog.setTitle(new GwtMessage().getMessage('Confirmation'));
dialog.setPreference('warning', true);
dialog.setPreference('title', new GwtMessage().getMessage("Turning off live feed will delete all live feed messages associated with this record group"));
dialog.setPreference('onPromptCancel', callback.bind(this));
dialog.render();
}
}
Step 2 : The UI page design in UI Pages module :
NOTE : The Name of the UI page you are about to design should be given same as the name you have passed as a parameter here var dialog = new GlideDialogWindow('glide_confirm_standard'); Means here my UI page name should be "glide_confirm_standard".
Open a New UI page to design. My code goes like this (in the HTML box) :
Code continued in the below screen shot :
What you can do is : Check for other UI pages in your instance and just copy & paste the HTML script here in your new UI Page and then just edit according to your needs.
Then we have a Client Script box below the HTML box. This box is used to validate or manipulate elements that you have put inside the pop-up.
Example according to the above pop-up example :
function invokePromptCallBack(type) {
var gdw = GlideDialogWindow.get();
if (type == 'ok')
var f = gdw.getPreference('onPromptComplete');
else
var f = gdw.getPreference('onPromptCancel');
if (typeof(f) == 'function') {
try {
f.call(gdw, gdw.getPreference('oldValue'));
} catch(e) {
}
}
gdw.destroy();
return false;
}
var gdw = GlideDialogWindow.get();
var focusButton = gdw.getPreference('defaultButton');
if (focusButton == null)
focusButton = 'cancel_button';
gel(focusButton).focus();
and now you are done.
Please let me know if you need further help.
Thanks,
Arnab