0 Replies Latest reply on Jun 12, 2018 8:42 PM by 3720696

    Using a JavaScript function to look at current url to determine which outside url to open

    3720696

      APEX 5.0.3.00.03

      I am fairly new to programming and APEX. I'm working on an assignment to create a link inside a report that will allow the user to go directly to another application upon clicking the linkable column base upon the environment they are currently using and directed to the same environment within the other application. For example: the report finds the Iglass alias name based on the Doc Id. The Iglass alias name is located in the Iglass application program and the objective is to connect to the Iglass application once the user clicks on the Iglass alias name.  The APEX interactive report's Iglass Alias column is set to link the user to the Iglass Application.  If the user is currently in the Development environment of APEX, when the user clicks on the Iglass Alias name, they should be redirected to the Iglass Application's Development environment login and the same should follow for which ever environment they are in while using APEX (e.g. QA or Production).  I have developed a code that should look at which APEX environment is being used and redirect the user to the corresponding environment in the Iglass application.  For example:    this is a screen shot of the APEX report

       

                                                                       This is a screen shot of the Iglass application's login. When the user clicks on the Iglass Alias name from APEX, they are redirected to the same environment in Iglass.  This should be done by condition, meaning the script should look at which ever environment the user is directing the connection from by looking at the current url and redirecting the user to the correct url for the corresponding environment. First, I am not sure if my script is correct, and then secondly, how to enter it into APEX so it can be executed.  My script is as follows:

       

      fuction urlLookup(){

      @if (Request::url() == 'https://eaiqa.sherwin.com/eisq_cgeisdb2/f?p=104:7:13389287222901::NO:::')

      {

      return '<a href=http://iglassqa.sherwin.com/iglass/</a>';

      }

      else if (Request::url() == 'https://eai.sherwin.com/eisp_cgeisdb1/f?p=104:7:15927013675975::NO:::')

      {

      return '<a href=http://iglass.sherwin.com/iglass/login.jsp</a>';

      }

      else (Request::url() == 'https://eaidev.sherwin.com/eisd_cgeisdb3/f?p=104:7:5073171593515::NO:::')

      {

      return '<a href=http://iglassdev.sherwin.com/iglass/</a>';

      }

      }

       

      Thank you for any assistance you may have.