Need Jelly Help - Conditionally display a UI Macro

perkinsarm
Mega Guru

I need show some HTML content on a form but only when the the record is of a certain type. This is a scoped application. The HTML content includes formatted instructions and links to more detailed knowledge articles and external company content. I need to do this in multiple places on the form.

We are still on Fuji.

I tried annotations. There is a bug that causes their content to get corrupted if you have more than one html annotation in a form section (I need three).

A UI-Macro formatter solves the display corruption problems, but I've had trouble hiding them on forms where they should not be shown.

Unfortunately, a UI Policy can only hide fields.

I have placed in id in the html and tried to hide them via DOM manipulation w/o luck in an onLoad client script.

Since they are already based on Jelly the last possible solution would be to add logic that would hide them if the record, an Engineering Work Order (EWO) is not the EWO Type where they need to be displayed (We have half a dozen EWO types and each forms vary baed on type).

Here is what I have tried. What I'm trying to do is determine the record type based on the ewo_type field and set the display attribute of the table to either 'none' or 'block'. I'm a Jelly novice, but have a lot of Javascript, HTML, CSS experience.

What am I missing?

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

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

      <table class="" style="width: 100%; display:displayType('Data Project')" id="u_ds_err_hlp_tbl">

              <tbody>

                      <tr data-annotation-type="Info Box Red" class="annotation-row" style="display: table-row;">

                              <td colspan="99" data-annotation-type="Info Box Red" class="annotation">

                                      <div class="annotation-wrapper" style="padding:2px 0px 0px 4px; direction:ltr;">

  <div style="border:none; padding: 0px;">Use our&#160;<a href="http://www.example.com/example/#v/tool/s/" target="_blank"> Discovery Tool</a>&#160;to check datastream names and start and end dates.</div>

                                      </div>

                              </td>

                      </tr>

              </tbody>

      </table>

  <script>

  function displayType(ewo_type)

  var displayed = 'none';

  if(g_form.ewo_type == ewo_type) {

  displayed = 'block';

  }

        gs.log(displayed);

  return displayed;

  }

  </script>

</j:jelly>

5 REPLIES 5

So I'm basically stuck at not being able to obtain the value of the EWO type field from the record that is displayed on the form within the Jelly script.


I've seen GlideRecord examples, but that seems unnecessary, would impact performance and might not be possible because I'd need the sys_id of the current record to query 'self'.



Thanks