List view in UI page

malu
Tera Contributor

Is it possible to bring up the list view in UI page.

eg: we have a baseline module , after creating a new baseline we can see the list of entries for a specific condition as shown below is it possisble to bring up these list (CMDB Baseline Entries) into an UI page ?

find_real_file.png

1 ACCEPTED SOLUTION

Hi Malu,



You need change the code of iframe like below code getting Incident list based on Caller




<g:ui_reference name="requester_id" query="active=true" table="sys_user" id="requester_id" value="${gs.getUserID()}" displayvalue="${gs.getUser().getName()}"/>
<button class="button" style="margin-left:5px" id="getList" onclick="getIncList();">Get User Incidents</button>


<div id="targetList">      
<iframe src="incident_list.do?sysparm_query=caller_id=javascript:gs.getUserID()" style="min-height:400px;width:100%;" scrolling="no" frameborder="0"></iframe>
</div>

<script>
        function getIncList(){
                  var caller = document.getElementById('requester_id').value ;
                  var newIframe = '<iframe src="incident_list.do?sysparm_query=caller_id='+caller+'" style="min-height:400px;width:100%;" scrolling="no" frameborder="0"></iframe>' ;
                  document.getElementById('targetList').innerHTML =newIframe ;
        }
</script>


View solution in original post

22 REPLIES 22

malu
Tera Contributor

Hi Gurpreet,


Any minor question....I'm struck in this . I have a UI page with 2 fields , one with reference field and another text area.


when selecting value for one field (reference) upon clicking on button then only the values needs to be populated in the comments section(text area) , In Client script i have used Ajax to populated the comments field upon selecting the reference field. So to avoid this i want to add a button and only comments should be populated after clicking on button.



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">


<style>


  li {


  display:inline;


  padding: 5px;


}


</style>



  <body style='background-color: lightblue'>


  <hr></hr>


  <header><center>


                <h3 style="color:black;">Test Snapshot</h3>


  </center></header><hr></hr>


<div id="section">


<br></br>


<!-- <table> -->


<!-- <tr id="dialogbuttons"> -->


      <td>


      <label>$[SP]$[SP]${gs.getMessage('Select your Text')}


<!-- <span class="required">*$[SP]$[SP]$[SP]</span> -->


  </label>


  </td>


  <td>


    <div class="label_left" style="width:200px">


    <g:ui_reference id="baselineToBeReturned" name="baselineToBeReturned" table="cmdb_baseline" onchange="setChangeBaseEntry()"/>


    </div>


  </td> <!--</tr> -->


  <!--</table> -->


  <br></br>



  <td>


  <button class="button" style="margin-left:5px" id="getList" onclick="getBaselineEntry();">Get Baseline Entries</button>


  </td>


  <br></br>


      <td>


      <label>$[SP]$[SP]${gs.getMessage('Changes for the above text')}


<!-- <span class="required">*$[SP]$[SP]$[SP]</span> -->


  </label>


  </td>


  <td>  


    <tr><td><textarea name="comments" id="comments" style="width: 100%; height:100px;"></textarea></td></tr>  


  </td>



  </div>


  </body>


  <br></br><br></br>


  <input type="button"


  onClick="window.print()"


  value="Print This Page"/>


</j:jelly>




CS:-



function setChangeBaseEntry(){


  if (gel('baselineToBeReturned').value == '') {


        gel('comments').value = '';


        return;


}


  var base_entry1 = gel('baselineToBeReturned').value;


  //var baseline_name = gel('sys_display.name').value;


  //var baseline_name = gel('name').value;


  var ga = new GlideAjax('getBaselineDataReturn');


  ga.addParam('sysparm_name','updateBaseLineReturn');


  ga.addParam('sysparm_baseL',base_entry1);


  ga.getXML(ResponseParse);




function ResponseParse(response){


// var answer = ga.requestObject.responseXML.getElementsByTagName("answer");


//     alert("answer==>"+answer);


      // gel('comments').value = answer;


// gel('comments').value = answer[0];


  var result = ga.requestObject.responseXML.getElementsByTagName("result");


      var message = result[0].getAttribute("answer");


      gel('comments').value = message;


}


}


malu
Tera Contributor

By clicking on Get Baseline Entries button , I need to populate comments field after that. Pls help


Well you have to troubleshoot the code using console log or alert statements . Make sure that you are getting some value in message and then your code should work.


malu
Tera Contributor

Hi Gurpreet,


Just one minor ask, Is it possible to bring up the below items into UI page? like what we did to bring List view. The below is the CI changes made to the specific CI.


find_real_file.png


Pls help!!


Hi Ravi,


It seems like you want to add Activity formatter on UI Page. Below page will help


Activity Formatter in UI Page - inMorphis