- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-12-2022 12:46 PM
Hello,
I have a requirement to create a UI Action that updates multiple release forms based on entries on a UI page. For some reason, my processing script is not working and the fields do not map. What should happen is that: 1. multiple records are selected in the My Groups Work list view, and then 2. the UI action "Validation Sign-Off" is engaged and the mandatory fields are populated and when the "Complete Sign-Off" button is clicked, the selected records are populated, the UI page closes and you are returned to the list view.
What is happening is the UI page is populated and when I click "Complete Sign-Off" it blanks out the fields and goes to a screen that only shows the UI page without updating any records selected. Can someone PLEASE tell me what I'm doing wrong?
The fields that need to be updated are: Validation Complete (validation_complete) and Work Notes (work_notes)
My code is below:
HTML Script:
<?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 currentTable = RP.getWindowProperties().get('current_table') || '';
var sysIDList = RP.getWindowProperties().get('sys_id_list') || '';
</g:evaluate>
<input type="hidden" name="current_table" value="$[currentTable]" />
<input type="hidden" name="current_table" value="$[sysIdList]" />
<table width="400">
<tr>
<td nowrap="true" valign="top" width="600%" height="100%">
<div class="col-md-8">
<span><b><font style="background-color:lightblue">${gs.getMessage('I confirm the application core functionality has been validated and deemed acceptable for use following this release. By checking this box I am signing off on validation.')}</font></b></span>
</div>
<tr>
<td>
<div class="mt-10" style="padding-left:15px;">
<label class="checkbox-label">
<label><b>${gs.getMessage('Validation Complete')}:</b></label>
<g2:ui_checkbox id="validation_complete" name="validation_complete" value="false" />
</label>
</div>
</td>
</tr>
</td>
</tr>
<tr>
<td>
<div class="col-md-8" style="padding-left:15px;">
<label><b>${gs.getMessage("Work Notes")}</b></label>
<textarea wrap="soft" autocomplete="off" rows="5" id="work_notes_update" data-length="4000" style="; width:150%; overflow:auto; background-color:LightGoldenRodYellow;" name="work_notes_update">${jvar_work_notes}</textarea>
</div>
</td>
</tr>
<tr>
<td colspan="2" style="text-align:right; padding-top:10px;">
<button class="btn btn-default" onclick="closeWindow()" style="margin-right:10px;">Cancel</button>
<button class="btn btn-primary" onclick="mass_updates()">Complete Sign Off</button>
</td>
</tr>
</table>
</g:ui_form>
</j:jelly>
Client Script:
function mass_updates(){
g_form.save();
GlideDialogWindow.get().destroy();
}
function closeWindow() {
GlideDialogWindow.get().destroy();
}
Processing Script:
updateMutlipleRecords();
function updateMutlipleRecords() {
var choice = new GlideRecord(current_table);
if (sys_id_list){
var selectedRecords = sys_id_list.split(',');
choice.addQuery('sys_id', selectedRecords);
}
choice.query();
while (choice.next()){
choice.validation_complete = validation_complete;
choice.work_notes_update = work_notes;
choice.update();
}
function assign(){
var urlOnStack = GlideSession.get().getStack().bottom();
response.sendRedirect(urlOnStack);
}
}
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-14-2022 11:09 AM
Hmm... I guess the worknotes field is wrong...
Replace
choice.work_notes_update = work_note_update;
with
choice.work_notes = work_note_update;
As for the redirection, you could simply hardcode the URL:
response.sendRedirect('/incident_list.do');
I think it should work, but I haven't tested it as my PDI has gone offline suddenly!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-14-2022 09:29 AM
Hi
THANK YOU SO MUCH for your help with this!!! By changing the Caller Access field on the table to Caller Tracking it allowed me to create the update without any cross-scope errors. The only issue now is that it is not taking me back to the list view and not updating the work notes field (the Validation Complete field is updated though). Can you please tell me how to resolve that part. My client script is copied below, the Processing script is the same as what you've suggested previously.
Redirects to the form:
Client Script:
function mass_updates(){
g_form.save();
GlideDialogWindow.get().destroy();
}
function closeWindow(){
GlideDialogWindow.get.destroy();
}
Processing Script:
updateMutlipleRecords();
function updateMutlipleRecords() {
gs.addInfoMessage('current_table - ' + current_table);
gs.addInfoMessage('sys_id_list - ' + sys_id_list);
gs.addInfoMessage('validation_complete - ' + validation_complete);
gs.addInfoMessage('work_notes - ' + work_notes_update);
var choice = new GlideRecord(current_table);
if (sys_id_list) {
var selectedRecords = sys_id_list.split(',');
choice.addQuery('sys_id', selectedRecords);
}
choice.query();
while (choice.next()) {
choice.validation_complete = validation_complete;
choice.work_notes_update = work_note_update;
choice.update();
}
var urlOnStack = GlideSession.get().getStack().bottom();
response.sendRedirect(urlOnStack);
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-14-2022 11:09 AM
Hmm... I guess the worknotes field is wrong...
Replace
choice.work_notes_update = work_note_update;
with
choice.work_notes = work_note_update;
As for the redirection, you could simply hardcode the URL:
response.sendRedirect('/incident_list.do');
I think it should work, but I haven't tested it as my PDI has gone offline suddenly!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-14-2022 01:33 PM
Hi
Thank you again so much for your help with this!!! It's functioning perfectly now - I really appreciate your help!!!