How do I get a UI Formatter to display in a specific location on a form?

andrew_lawlor
Giga Expert

Hello -- I have a question regarding UI Macros, UI Formatters and Scrollable Areas.

 

I created a UI macro that contains a script to create a scrolling newsfeed that displays relevant articles. I then linked my UI Maco to a UI Formatter and placed it in a specific location on a form. Everything looks and works great, but the newsfeed isn't displaying in the proper location. Instead of displaying in the mid left corner before a |Split|, it's displaying at the top left of the form above all of the other fields.

 

Here's an image to give you an idea of where it is:

Layout.PNG

The precise location of this feed is a crucial part of the request. I've experimented with several settings, such as height and width, but none of that has fixed the problem.

 

Thanks in advance for any help you might be able to provide!

 

A.

1 ACCEPTED SOLUTION

Try adding



<tr><td colspan='2'> (your code here) </td></tr>



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


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


<tr><td colspan='2'>


  <g2:evaluate var="jvar_kb">


      var kb = new GlideRecord('kb_knowledge');


      var now = gs.dateGenerate(gs.yesterday(), 'end');


      kb.addQuery('valid_to', '>', now);


      <j:if test="${!gs.hasRole('itil')}">


      var grOR = kb.addQuery('role', 'public');


      grOR.addOrCondition('role','');


      </j:if>


      kb.addQuery('topic','News');


      kb.addQuery('workflow_state','published');


      kb.setLimit(5);


      kb.query();


  </g2:evaluate>




  <g2:scrollable_area height="100px" width="50%">


          <font color="blue">   Hello, ${gs.getUserDisplayName()} --


      Please take a moment to read the latest Certification News: </font> <br/>


          <j2:while test="$[kb.next()]">


              <j2:set var="jvar_kb_link" value="kb_view.do?sys_kb_id=$[kb.sys_id]"/>


                  <a href="$[jvar_kb_link]" style="padding-right:10px; color:black">$[kb.short_description]</a><br/>


          </j2:while>


 


  </g2:scrollable_area>


</td></tr>


</j:jelly>


View solution in original post

4 REPLIES 4

Masha
Kilo Guru

What is the code of your ui Macro. I am wondering what HTML and/or CSS you are using.


Here is the code for the UI Macro:



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


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


  <g2:evaluate var="jvar_kb">


      var kb = new GlideRecord('kb_knowledge');


      var now = gs.dateGenerate(gs.yesterday(), 'end');


      kb.addQuery('valid_to', '>', now);


      <j:if test="${!gs.hasRole('itil')}">


      var grOR = kb.addQuery('role', 'public');


      grOR.addOrCondition('role','');


      </j:if>


      kb.addQuery('topic','News');


      kb.addQuery('workflow_state','published');


      kb.setLimit(5);


      kb.query();


  </g2:evaluate>



 


  <g2:scrollable_area height="100px" width="50%">


          <font color="blue">   Hello, ${gs.getUserDisplayName()} --


      Please take a moment to read the latest Certification News: </font> <br/>


          <j2:while test="$[kb.next()]">


              <j2:set var="jvar_kb_link" value="kb_view.do?sys_kb_id=$[kb.sys_id]"/>


                  <a href="$[jvar_kb_link]" style="padding-right:10px; color:black">$[kb.short_description]</a><br/>


          </j2:while>


   


  </g2:scrollable_area>


</j:jelly>


Try adding



<tr><td colspan='2'> (your code here) </td></tr>



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


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


<tr><td colspan='2'>


  <g2:evaluate var="jvar_kb">


      var kb = new GlideRecord('kb_knowledge');


      var now = gs.dateGenerate(gs.yesterday(), 'end');


      kb.addQuery('valid_to', '>', now);


      <j:if test="${!gs.hasRole('itil')}">


      var grOR = kb.addQuery('role', 'public');


      grOR.addOrCondition('role','');


      </j:if>


      kb.addQuery('topic','News');


      kb.addQuery('workflow_state','published');


      kb.setLimit(5);


      kb.query();


  </g2:evaluate>




  <g2:scrollable_area height="100px" width="50%">


          <font color="blue">   Hello, ${gs.getUserDisplayName()} --


      Please take a moment to read the latest Certification News: </font> <br/>


          <j2:while test="$[kb.next()]">


              <j2:set var="jvar_kb_link" value="kb_view.do?sys_kb_id=$[kb.sys_id]"/>


                  <a href="$[jvar_kb_link]" style="padding-right:10px; color:black">$[kb.short_description]</a><br/>


          </j2:while>


 


  </g2:scrollable_area>


</td></tr>


</j:jelly>


Thanks -- that worked perfectly! I appreciate your time.



Andrew