- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-28-2020 01:39 AM
Hi All,
I have a requirement where i need to give specified time to user to review the form. when user clicks on alert button then my ui page should refresh. So that i can get all default values that was there on that ui page and my timer can restart .
I am not getting any code to refresh ui page so that my ui page timer restarts with default values.
Pls help.
Regards,
Nikita
Solved! Go to Solution.
- Labels:
-
Request Management
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-02-2020 12:15 AM
Hi Nikita,
I have created a similar case and I could achieve it. Here is what I have done.
UI action
function openPage(){
var dialog = new GlideDialogWindow('Test UI');
dialog.setTitle(getMessage('Testing 123'));
dialog.setPreference('label', 'Can you please choose an option?'); // This is the input for UI page, which would be default
dialog.render();
}
UI page
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>
<!-- Get values from dialog preferences passed in -->
<g2:evaluate var="jvar_label" expression="RP.getWindowProperties().get('label')" />
<g2:evaluate var="jvar_optionName" jelly="true" object="true" >
var options =RP.getWindowProperties().get('optionName');
options = options.split(",");
var choiceArray = [];
//<![CDATA[
for(var i = 0; i<options.length; i++){
choiceArray.push(options[i]);
}
//]]>
choiceArray;
</g2:evaluate>
<input id="label_id" type="HIDDEN" value="$[jvar_label]"/>
<!-- Set up form fields and labels -->
<table width="100%">
<tr>
<td>
<g:ui_choice_input_field name="TestChoice" id="chooseOption" label="$[jvar_label]" mandatory="true">
<option value="">${gs.getMessage('-- None --')}</option>
<option value="other">Other</option>
</g:ui_choice_input_field>
</td>
</tr>
<tr>
<td colspan="2">
</td>
</tr>
<tr id="dialog_buttons">
<td colspan="2" align="right">
<g:dialog_button_ok ok="return getChoices()" ok_type="button" />
</td>
</tr>
</table>
</g:ui_form>
<button onclick="reincarnate()">Cancel</button>
</j:jelly>
Client Script
function reincarnate(){
var labelValue = document.getElementById("label_id").value;
GlideDialogWindow.get().destroy();
setTimeout(function(){ openPage(labelValue);}, 1000);
}
function openPage(value){
var dialog = new GlideDialogWindow('Test UI');
dialog.setTitle(getMessage('Testing 123'));
dialog.setPreference('label', value);
dialog.render();
}
In above example, I could destroy the GlideModal and recreate it.
In your case, You could create hidden input fields and store the values of parameters inside those hidden inputs.
Below are the inputs I see you are receiving in UI page
<j:set var="jvar_email" value="${JS:RP.getWindowProperties().get('email_ids')}" />
<j:set var="jvar_ccemail" value="${JS:RP.getWindowProperties().get('ccemail_ids')}" />
<j:set var="jvar_bccemail" value="${JS:RP.getWindowProperties().get('bccemail_ids')}" />
<j:set var="jvar_blacklist" value="${JS:RP.getWindowProperties().get('bclist_ids')}" />
<j:set var="jvar_sys_id" value="${JS:RP.getWindowProperties().get('sys_id')}" />
<j:set var="jvar_subject" value="${JS:RP.getWindowProperties().get('subject')}" />
Further on cancel, you can reopen the UI page by passing setpreferences from hidden fields.
Note : You need to use setTimeout and get value of hidden fields into variable before detroying the GlideModal.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-29-2020 04:51 AM
Hi Ankur,
It's not working.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-29-2020 05:00 AM
Hi Nikita,
what is happening when you are using that?
can you explain
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-01-2020 09:39 PM
Hi Ankur,
I am still getting the same ui page with checked checkboxes when i am writing the code you shared above. I am not able to see the default ui page.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-01-2020 10:45 PM
Hi,
I believe there is no other way other than calling the UI page again via GlideDialogWindow
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-01-2020 11:25 PM
Hi Ankur,
Can i do coding like:- ritm form gets reloaded and then ui page opens automatically when user clicks on ok button in alert box.
