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

iFrame UI Action Redirect Problem

markmmiller09
Kilo Expert

I'm working on a CMS site and am running into an issue with the out-of-the-box redirect's for UI actions on forms within iFrames.

I have a CMS page which provides a link of all approvals for the user. When the user clicks on an approval, they are taken to a new page which contains the approval form in an iFrame. The user has the standard UI actions: Update, Approve, Reject, etc. When a UI action is clicked, the out-of-the-box redirect is at the iFrame level, so essentially I am getting the entire previous page within the iFrame and it looks something like this:

main_page.jpg

I have tried:

  • using action.setRedirectURL('my_approvals.do'); within the UI action
    • If I use this approach, I am still targeting the iFrame
  • using a client onClick function which calls the browser's window.history.back() function
    • if I use this approach, then the approval isn't approved/rejected

I would rather not have to go through every UI action that will be used on the CMS site and modify the redirects... I was hoping to use jQuery to select all form buttons and add an event listener to redirect, but I don't think this will work since the ServiceNow Approve function never gets called.

Any ideas?

Thanks in advance

8 REPLIES 8

ChrisBurks
Giga Sage

Hi Mark,



How did you bring your lists of approvals and the approval form into iframe?


Hey Chris,



I used a dynamic block to bring in a list block of records shown below:



<?xml version="1.0" encoding="utf-8" ?>


<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">



<div class="col-xs-3"> <!-- required for floating -->


      <!-- Nav tabs -->


      <ul class="nav nav-tabs tabs-left">


          <li><a href="my_requests.do">My Requests</a></li>


          <li><a href="my_incidents.do">My Incidents</a></li>


          <li class="active"><a href="my_approvals.do">My Approvals</a></li>


      </ul>


</div>



<div class="col-xs-9">


      <!-- Tab panes -->


      <div class="tab-content">


          <div class="tab-pane active" id="my_approvals">


              <h2>My Approvals</h2>


              <br/>


              <g:content_block type="content_block_lists" id="b9ea33d34f8006007b338b8d0210c7b6"/>


          </div>


      </div>


</div>


</j:jelly>





I added this dynamic block to a page.



For the form, I used a detail block which renders the form automatically.


Gurpreet07
Mega Sage

Check the Frame buster checkbox form main page and you are done.


Hello Gurpreet,



Checking the iFrame buster box did not work.