Ankur Bawiskar
Tera Patron
Tera Patron

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
sameershind
Tera Contributor

Hi @Ankur Bawiskar
Is this UI Action  calling UI Page from Server code?

Ankur Bawiskar
Tera Patron
Tera Patron

Client side UI action

sameershind
Tera Contributor

Hi @Ankur Bawiskar

Thanks for prompt reply. In my requirement I have created UI action for List Banner Button where I get two object parent referring to current record on which related list is present and Current contains sys id of record selected in list before pressing UI Action. 

Original Requirement:
There should be a button on related list on click it should ask for a comment of rejection and change the state of selected records and update the comment of rejection.

How can I achieve this using UI page?

Version history
Last update:
‎12-28-2024 04:07 AM
Updated by:
Contributors