How to call UI Page from Workspace Client Script

kshitij11
Tera Contributor

I have a requirement to enable the workspace client script for below script used in one of the UI Action"show Interaction Content":

 Script:

function doShowInteraction(){
console.log("doShowInteraction calling");
var sys_id = g_form.getUniqueValue();
console.log("doShowInteraction sys_id:" + sys_id);

var gdw = new GlideDialogWindow("x_sofin_cti_connec_IXNWebApp");
gdw.setTitle("Genesys Interaction Content");
gdw.setSize(1000,600);
gdw.setPreference("sysparm_id", sys_id);
gdw.setPreference("sysparm_type", "interaction");

gdw.render();
}

UI Page(IXNWebApp):

<?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 applicationUrl = gs.getProperty('x_sofin_cti_connec.applicationUrl');
var sysparm_id = RP.getParameterValue("sysparm_id");
var sysparm_type = RP.getParameterValue("sysparm_type");
var gr = new GlideRecord(sysparm_type);
gr.addQuery('sys_id', sysparm_id);
gr.query();
</g:evaluate>

<j:if test="${gr.next()}">
<j:set var="jvar_inc" value="${gr.contact_type}" />
<iframe src="${applicationUrl}id=${gr.x_sofin_cti_connec_interaction_id}" style='border:0px; width:100%;height:600px'></iframe>
</j:if>

</j:jelly>

 

Workspace Client script

Please help me the worskpace client script as few functions used in above script like GlideDialogWindow are not supported and I dont know how to use g_modal for calling the above UI Page.

Requirement is to make the UI Action"show Interaction Content" work in Agent workspace, its working perfectly fine in normal view

1 ACCEPTED SOLUTION

kshitij
Giga Expert

Try this solution:

function onClick(g_form) {

 

var sys_id = g_form.getUniqueValue();

 

g_modal.showFrame({title: 'Interaction Content', url: 'x_sofin_cti_connec_IXNWebApp?sysparm_id=' + sys_id + '&sysparm_type=interaction', size:'fw'});

}

View solution in original post

6 REPLIES 6

what is the 'x_sofin_cti_connec_IXNWebApp'

i write a ui action on the change request my ui page name is cancel Custom.

please provide me the answer.

can you explain me this below line?

''g_modal.showFrame({title: 'Interaction Content', url: 'x_sofin_cti_connec_IXNWebApp?sysparm_id=' + sys_id + '&sysparm_type=interaction', size:'fw'});''

Marrysmithgs
Tera Contributor

@kshitij11 wrote:

I have a requirement to enable the workspace client script for below script used in one of the UI for discord roles Action"show Interaction Content":

 Script:

function doShowInteraction(){
console.log("doShowInteraction calling");
var sys_id = g_form.getUniqueValue();
console.log("doShowInteraction sys_id:" + sys_id);

var gdw = new GlideDialogWindow("x_sofin_cti_connec_IXNWebApp");
gdw.setTitle("Genesys Interaction Content");
gdw.setSize(1000,600);
gdw.setPreference("sysparm_id", sys_id);
gdw.setPreference("sysparm_type", "interaction");

gdw.render();
}

UI Page(IXNWebApp):

<?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 applicationUrl = gs.getProperty('x_sofin_cti_connec.applicationUrl');
var sysparm_id = RP.getParameterValue("sysparm_id");
var sysparm_type = RP.getParameterValue("sysparm_type");
var gr = new GlideRecord(sysparm_type);
gr.addQuery('sys_id', sysparm_id);
gr.query();
</g:evaluate>

<j:if test="${gr.next()}">
<j:set var="jvar_inc" value="${gr.contact_type}" />
<iframe src="${applicationUrl}id=${gr.x_sofin_cti_connec_interaction_id}" style='border:0px; width:100%;height:600px'></iframe>
</j:if>

</j:jelly>

 

Workspace Client script

Please help me the worskpace client script as few functions used in above script like GlideDialogWindow are not supported and I dont know how to use g_modal for calling the above UI Page.

Requirement is to make the UI Action"show Interaction Content" work in Agent workspace, its working perfectly fine in normal view


The first piece of this solution is to set up some mechanism to trigger your GlideDialogWindow. For this example I’ve chosen to use a UI Action button. Here are the details of the button. The comments in the script explain how to initialize the dialog and pass parameters on to your UI Page to populate information there.

 

function commentsDialog() {
//Get the values to pass into the dialog
var comments_text = g_form.getValue("comments");
var short_text = g_form.getValue("short_description");//Initialize and open the Dialog Window
var dialog = new GlideDialogWindow("task_comments_dialog"); //Render the dialog containing the UI Page 'task_comments_dialog'
dialog.setTitle("Add Task Comments"); //Set the dialog title
dialog.setPreference("comments_text", comments_text); //Pass in comments for use in the dialog
dialog.setPreference("short_text", short_text); //Pass in short description for use in the dialog
dialog.render(); //Open the dialog
}