Tried --> GlideDialogWindow: Advanced Popups Using UI Pages --> <Page Not Found> / Loading...

Simon Ciglia
Giga Guru

I tried to add a Pop-Up according to the following tutorial (Kingston Release)
https://www.servicenowguru.com/system-ui/glidedialogwindow-advanced-popups-ui-pages/

The Dialog appears but the error message is: Page not found...or it stays at Loading...
The name of the UI Page is correct...

 

function commentReason() {
//Get the values to pass into the dialog
var reason_text = g_form.getValue("reason");
//Initialize and open the Dialog Window
var dialog = new GlideDialogWindow('testSic'); //Render the dialog containing the UI Page 'TVDTaskManagementReason'
dialog.setTitle("Add Reason"); //Set the dialog title
dialog.setSize(750,300);
dialog.adjustBodySize();
dialog.setPreference("reason_text", comments_text); //Pass in comments for use in the dialog
dialog.render(); //Open the dialog
}

 

UI Page name

testSic

 find_real_file.png

1 ACCEPTED SOLUTION

Shambhu5
Kilo Guru

Hi Simicc,

I have tried using your UI page content alongwith my UI Action, a dialogbox appears which shows "Additional Comments" Multiple line text, along with Cancel & Ok buttons. This is exactly what you want. Right?

Please find my UI Action Script below:

find_real_file.png

 

Also, please tell me, is this issue with you only in Kingston Release? And on what Version are you working?

Above code worked fine for me.

 

Please hit Correct or Helpful if it somehow helped you resolve your issue.

 

Regards,
Vishrut
find_real_file.png

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

View solution in original post

6 REPLIES 6

nayanawadhiya1
Kilo Sage

comments_text is not a variable that you passing replace with correct name i.e. 'reason_text'.

Can you show your UI Page Coding?

It should be like this - 

function commentReason() {
//Get the values to pass into the dialog
var reason_text = g_form.getValue("reason");
//Initialize and open the Dialog Window
var dialog = new GlideDialogWindow('testSic'); //Render the dialog containing the UI Page 'TVDTaskManagementReason'
dialog.setTitle("Add Reason"); //Set the dialog title
dialog.setSize(750,300);
dialog.adjustBodySize();
dialog.setPreference("reason_text", reason_text); //Pass in comments for use in the dialog
dialog.render(); //Open the dialog
}

And in UI Page it should be like this -

 <g:evaluate var="jvar_short_text"
    expression="RP.getWindowProperties().get('reason_text')" />

Shambhu5
Kilo Guru

Hi,

In this code, everything seems fine to me, except that try adding 2 set preferences in your code as follows;

dialog.setPreference("comments_text", comments_text);

dialog.setPreference("short_text", short_text);

Still if issue exists, than please provide your UI Page "testSic" code. There might be the issue.

 

Regards,

Vishrut

 

Simon Ciglia
Giga Guru

Thank you :-), but it is still not working 😞

 

Updated UI Action Code

function commentReason() {
//Get the values to pass into the dialog
var reason_text = g_form.getValue("reason");
//Initialize and open the Dialog Window
var dialog = new GlideDialogWindow('testSic'); //Render the dialog containing the UI Page 'TVDTaskManagementReason'
dialog.setTitle("Add Reason"); //Set the dialog title
dialog.setSize(750,300);
dialog.adjustBodySize();
dialog.setPreference("reason_text", reason_text); //Pass in comments for use in the dialog
dialog.render(); //Open the dialog
}

 

Updated UI Page (testSic)

<?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 -->
<g:evaluate var="jvar_short_text"
    expression="RP.getWindowProperties().get('reason_text')" />
	

     <!-- Set up form fields and labels -->

     <table width="100%">

         <tr id="description_row" valign="top">

               <td colspan="2">

                     <!-- Short description value used as a label -->

                     ${jvar_short_text}

               </td>

         </tr>

         <tr>

             <td>

                 <!-- Comments text field (Contains comments from originating record as a default) -->

                 <g:ui_multiline_input_field name="dial_comments" id="dial_comments" label="Additional comments" value="${jvar_comments_text}" mandatory="true" />

             </td>

         </tr>

         <tr>

             <td colspan="2">

             </td>

         </tr>

         <tr id="dialog_buttons">

               <td colspan="2" align="right">

                     <!-- Pull in 'dialog_buttons_ok_cancel' UI Macro for submit/cancel buttons.

                   'ok' option will call the 'validateComments' Client script function from the UI Page-->

                     <g:dialog_buttons_ok_cancel ok="return validateComments()" ok_type="button" cancel_type="button" />

               </td>

         </tr>

   </table>

</g:ui_form>
</j:jelly>

Your UI Page is not correct.

Try this - 

<?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 -->
<g:evaluate var="jvar_short_text"
    expression="RP.getWindowProperties().get('reason_text')" />
	

     <!-- Set up form fields and labels -->

     <table width="100%">

         <tr id="description_row" valign="top">

               <td colspan="2">
                     <!-- Short description value used as a label -->
                     ${jvar_short_text}
               </td>
         </tr>
         <tr>
         </tr>
         <tr>
             <td colspan="2">
             </td>
         </tr>

         <tr id="dialog_buttons">

               <td colspan="2" align="right">

                     <!-- Pull in 'dialog_buttons_ok_cancel' UI Macro for submit/cancel buttons.

                   'ok' option will call the 'validateComments' Client script function from the UI Page-->

                     <g:dialog_buttons_ok_cancel ok="return validateComments()" ok_type="button" cancel_type="button" />

               </td>
         </tr>
   </table>
</g:ui_form>
</j:jelly>