UI page not working in workspace

sarankumar3272
Tera Expert

I have UI page which I'm calling from UI action. It is working fine as expected in native view but not in workspace view. 

 

The purpose here is to select template in page apply to form based on current assignment group

 

I'm able to identify  that "RP.getWindowProperties()" wont support in workspace. But not sure what will be replacement for this

sarankumar3272_0-1718124792395.png

 

UI action script 

function showTemplate() {
	var grpName = g_form.getValue('assignment_group');
    var templateList = new GlideDialogWindow('x_dropb_finance_show_templates_list');
    templateList.setTitle('Templates');
    templateList.setSize(300, 300);
    templateList.setPreference('groups',grpName);
    templateList.render();
}

 UI action Workspace Client Script

function onClick(g_form) {
var grpName = g_form.getValue('assignment_group');

//g_modal.showFrame({title: 'Templates', url: 'x_dropb_finance_show_templates_list?groups=' + grpName, size:'300'});
	
	var ui_page_id = '6cd8b709db2f8d107a4bde46d496193c';
    g_modal.showFrame({
        url: '/ui_page.do?sys_id=' + ui_page_id+'&groups='+grpName,
        title: 'Choose a template',
        size: 'xl',
        height: 500
    });
	
}

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:evaluate var="jvar_assignment_group" jelly="true" expression="RP.getWindowProperties().groups" /> 

<g:evaluate var="jvar_gr" object="true" jelly="true">
        var test = new GlideRecord('sys_template');
	test.addQuery('table','x_dropb_finance_finance_case');
	test.addQuery('groups','${jvar_assignment_group}');
      test.query();
        test;
    </g:evaluate>
    <g:ui_form>
		<g:evaluate var="jvar_assignment_group" expression="RP.getWindowProperties().groups" /> 
     		  <table style="width: 100%">
	 
<tr>
       <td style="width: 40%">
         	Name
       </td>
		   <td style="width: 60%" >
         	<g:ui_reference name="tempVals" id="tempVals" table="sys_template" query="table=x_dropb_finance_finance_case^groups=${jvar_assignment_group}" />
       </td>
     </tr>
			
		 </table>
        <div class="row">
            <div class="col-md-12">
                <div class="pull-right">
                   <g:dialog_buttons_ok_cancel ok="save()" ok_type="button" cancel_type="button" /> 
				<!-- 	<g:dialog_buttons_ok_cancel ok="save()" cancel="cancel()" /> -->
                </div>

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

UI page client script

function save() {
	var selectVals = gel('tempVals').value;
	g_form.setValue('templates',selectVals);
	GlideDialogWindow.get().destroy();

}

 

1 REPLY 1

Danish Bhairag2
Tera Sage
Tera Sage

Hi @sarankumar3272 ,

 

Please try this

 

https://www.servicenow.com/community/next-experience-articles/how-to-use-ui-actions-in-workspaces/ta...

 

Ui page is not supported in workspace it seems.

Above link should help u

 

Thanks,

Danish