UI page not working in agent workspace
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-12-2022 04:53 AM
Hi All,
Can anyone assist me to run the below code
When user click on UI action then pop up box should appear on agent workspace and the comments which we have added under pop up the same should be added in custom field(u_level_1_escalation).
I have configured UI action, the code in workspace client script as follows:
var sys_id = g_form.getUniqueValue();
function escalateLevelTwo(response) {
var answer = response.responseXML.documentElement.getAttribute("answer");
if (answer == 'false') {
var gdtajax = new GlideAjax('ClientDateTimeUtils');
gdtajax.addParam('sysparm_name', 'getNowDateTimeDiffTwo');
gdtajax.addParam('sysparm_fdt2', escalation_time_l1);
gdtajax.getXML(nowTimeResponseTwo);
} else {
g_modal.showFrame({
title:'Please provide the reason for Level 2 escalation?',
url:'escalation_comments_aw.do?sysparm_sys_id='+ sys_id
});
}
UI page :
HTML code:
<g:ui_form>
<input type="hidden" id="cancelled" name="cancelled" value="false"/>
<table width="100%">
<tr id="description_row" valign="top">
</tr>
<tr>
<td align="left">
<!-- Comments text field (Contains comments from originating record as a default) -->
<g:ui_multiline_input_field name="escalate_commentsTwo" id="escalate_commentsTwo" label="" mandatory="True" />
</td>
</tr>
<tr>
<td colspan="10">
</td>
</tr>
<tr id="dialog_buttons">
<td colspan="2" align="center">
<!-- 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 validateEscalateCommentsTwo()" cancel="return back()" ok_type="button" cancel_type="button" />
</td>
</tr>
</table>
</g:ui_form>
Client script code:
function validateEscalateCommentsTwo() {
//Gets called if the 'OK' dialog button is clicked
//Make sure dialog comments are not empty
var levelOne = g_form.getValue('u_escalation_comment');
var comments = levelOne + '\n' + 'Level 2 escalation comments:' + '' + gel("escalate_commentsTwo").value;
comments = trim(comments);
if (comments == "") {
//If comments are empty stop submission
alert("Please provide the reason for escalation.");
return false;
}
var record = g_form.getUniqueValue();
var ajax3 = new GlideAjax('ClientDateTimeUtils');
ajax3.addParam('sysparm_name', 'getNowDateTimeFour');
ajax3.addParam('sysparm_record', record);
ajax3.addParam('sysparm_comments', comments);
ajax3.getXML(nowTime);
function nowTime(response) {
var answer = response.responseXML.documentElement.getAttribute("answer");
g_form.setValue('u_level_1_escalation', answer);
}
}
function back() {
location.reload();
var c = gel('cancelled');
c.value = "true";
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-12-2022 05:10 AM
Hi Titiksha,
Agent Workspace doesn't support rendering of UI Pages/Macros. Workaround for UI page in Agent Workspace would be Modals. Please refer this link for more info.
Please Mark this helpful if it solves your problem.
Regards,
Amitoj Wadhera