custom UI pages are not working on case form

sri6now
Giga Contributor

Hi Team,

I wanted to change the case type (custom field) in case form through UI action using GlideDialogWindow or GlideModal.

1. created a ui page( change_case) in 'Customer Service' application :

<!-- <?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>
<g:evaluate var="jvar_number" expression="RP.getWindowProperties().get('case_number')" />
<g:evaluate var="jvar_sys_id" expression="RP.getWindowProperties().get('c_sysid')" />

<table width="100%">

<g:ui_multiline_input_field name="coms" id="coms" mandatory="true" label="Additional Comments"/>

<tr id="dialog_buttons">
<td></td>
<td>
<!-- 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-->
<div class="form-group pull-right form-group-height" style="padding-right: 20px;">
<g:dialog_buttons_ok_cancel ok="return onOK()" cancel="return onCancel()" ok_type="button" cancel_type="button"/>
</div>
</td>
</tr>
</table>
</g:ui_form>

</j:jelly>

 

2.  Created UI action ( Convert Case ) on 'Customer Service' application

onClick : convertCase()

function convertCase() {

var case_number = g_form.getValue("number");
var c_sysid = g_form.getUniqueValue();

// var dialogClass = window.GlideModal ? GlideModal : GlideDialogWindow;
var dialog = new GlideDialogWindow("sn_customerservice_change_case");

dialog.setSize(500, 800);

dialog.setTitle("Change Case"); //Set the dialog title
dialog.setPreference("case_number", case_number);
dialog.setPreference("c_sysid", c_sysid);

dialog.render(); //Open the dialog
}

When I click on 'Convert Case' button, dialog is opening but getting ' The page you are looking for could not be found.'

 

find_real_file.png

Am I missing anything ?

Appreciate your help.

 

 

1 ACCEPTED SOLUTION

sri6now
Giga Contributor

Hi Ankur,

I am not sure what was wrong with old UI Pages and UI actions.

After creating new UI page and Actions its working fine. only I had to change in UI page to get variables.

instead of using 

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

replaeced with 

<g:evaluate jelly="true">var case_number = jelly.sysparm_case_number;</g:evaluate>

 

Thank you very much for you responses. 

View solution in original post

13 REPLIES 13

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

for scoped application you should call the complete UI page endpoint

Can you share UI page screenshot?

Regards
Ankur

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

sri6now
Giga Contributor

Thank You Ankur for you response here is the the UI action. 

find_real_file.png

update as this

function convertCase() {

var case_number = g_form.getValue("number");
var c_sysid = g_form.getUniqueValue();

// var dialogClass = window.GlideModal ? GlideModal : GlideDialogWindow;
var dialog = new GlideDialogWindow("sn_customerservice_change_case");

dialog.setSize(500, 800);

dialog.setTitle("Change Case"); //Set the dialog title
dialog.setPreference("sysparm_case_number", case_number);
dialog.setPreference("sysparm_c_sysid", c_sysid);

dialog.render(); //Open the dialog
}

UI page

<!-- <?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>
<g:evaluate var="jvar_number" expression="RP.getWindowProperties().get('sysparm_case_number')" />
<g:evaluate var="jvar_sys_id" expression="RP.getWindowProperties().get('sysparm_c_sysid')" />

<table width="100%">

<g:ui_multiline_input_field name="coms" id="coms" mandatory="true" label="Additional Comments"/>

<tr id="dialog_buttons">
<td></td>
<td>
<!-- 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-->
<div class="form-group pull-right form-group-height" style="padding-right: 20px;">
<g:dialog_buttons_ok_cancel ok="return onOK()" cancel="return onCancel()" ok_type="button" cancel_type="button"/>
</div>
</td>
</tr>
</table>
</g:ui_form>

</j:jelly>

Regards
Ankur

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

sri6now
Giga Contributor

UI Page :

find_real_file.png