logo

NJP

Update record using UI page and UI action

New article articles in ServiceNow Community · Dec 28, 2024 · article

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" ?>

/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(); }

View original source

https://www.servicenow.com/community/service-operations-workspace/update-record-using-ui-page-and-ui-action/ta-p/3136924