The CreatorCon Call for Content is officially open! Get started here.

Need help mapping fields on a UI Page to form(s) - PLEASE ASSIST

Nya Valdez
Kilo Guru

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);
              }
}
1 ACCEPTED SOLUTION

@Nya Valdez 

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!

View solution in original post

17 REPLIES 17

Hmm... Try looking in System Applications -> Application Restricted Caller Access

See if there is a new record created with Status as Requested/denied...

No, there isn't anything there ... should I create an ACL to allow the operation to work in another scope?

What is the table config like?

find_real_file.png

 

The Restricted Caller Access module should help us in these issues generally... Try again with a created z-a... 

Hi @AnirudhKumar 

I just updated it to add the "Can Update" option from all application scopes and got the same cross-scope policy error when I tested it.  Here is what the table looks like: 

find_real_file.png

Thank you again (SO MUCH!!!) for your help with this!!

@Nya Valdez ,

Set Caller Access to Caller Tracking

And perform your process with the UI page until you see the same error again.

I'm hoping system will now create our cross-scope access record in the Restricted Caller Access table. Open the record, it should have Target Scope as your custom scope , Target as your custom table name and Status as Requested... 

Set Status to Allowed...

 

Edit:

Oh Wait... Navigate to System Applications -> Application Cross-Scope Access.

See if a new record was created for your scope... Set its status to Allowed

 

Fingers crossed.