Ankur Bawiskar
Tera Patron
Options
- Post History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
on 12-28-2024 04:07 AM
Many a times there is a requirement to show UI page and take input from user and update the current record.
This can be handled using an UI page which gets invoked from UI action.
Something similar below, please enhance it as per your requirement.
HTML:
<?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_sysid"
expression="RP.getWindowProperties().sysid"/>
<table border="0" width="100%">
<tr>
<td>
<g:ui_multiline_input_field name="notes" label="update" mandatory="true" />
</td>
</tr>
<tr>
<td>
<g:dialog_buttons_ok_cancel cancel="return onCancel();" ok="return onSubmit();"/>
<input type="hidden" id="task_sys_id" name="task_sys_id" value="${jvar_sysid}"/>
</td>
</tr>
</table>
</g:ui_form>
</j:jelly>
Client Script:
function onCancel() {
GlideDialogWindow.get().destroy();
return false;
}
function onSubmit() {
var data = gel('notes').value;
var sysId = gel('task_sys_id');
var app = new GlideRecord("incident");
if(app.get(sysId)){
app.description = data;
app.update();
}
window.open('/incident.do?sys_id='+sysId);
}
UI Action:
function confirmAction() {
var dialog = new GlideDialogWindow('ui page name');
dialog.setTitle('Reopen');
dialog.setPreference('sysid', g_form.getUniqueValue());
dialog.render();
}
Comments