- 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-12-2022 01:02 PM
The processing script does not need to be enclosed in a function.
Just use:
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);
}
Edit:
I just saw 2 HTML having the same name attribute, is that intentional?
<input type="hidden" name="current_table" value="$[currentTable]" />
<input type="hidden" name="current_table" value="$[sysIdList]" />
Remember to give a unique name and also set the id attribute
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-12-2022 02:11 PM
Hello AnirudhKumar,
Thank you so much for your response. Unfortunately even with modifying my processing script as you have directed the records are not updating and it is not redirecting back to the list view - instead it still redirects back to the form with empty fields. Please advise.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-13-2022 10:28 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-13-2022 10:35 AM
Oops, give me a few min, let me replicate the code in my PDI