UI Policy to show form section on condition. Included annotation not showing up on form section.

scottatah
Giga Expert

Hi Everyone,

 

Working in Eureka Patch 2 (development instance), I've built a UI policy to show a new form section when certain conditions on the Incident form are met.   While the form section and all of it's fields show, I've added an annotation at the top of this form section and it's seemingly only visible to me.   No ITIL users (so far), nor even another admin.

 

Since I'm going a little out of my realm in building this, I'll try to explain exactly what I've built.  

 

UI Policy on the Incident table

Conditions

  • Business Unit = IS
  • Priority = 1

Global = yes

Reverse if false = yes

On Loaad = yes

Inherit = no

 

If true script:

function onCondition() {

      try{

              //Show the closure form section

              var sections = g_form.getSections();

              sections[4].style.display = 'block';

      }catch(e){}

      g_tabs2Sections.setActive(3);

}

 

If false script:

function onCondition() {

    try{

    //Hide the closure form section

    var sections = g_form.getSections();

    sections[4].style.display = 'none';

    }catch(e){}

}

 

UI Policy Actions

  • Field 1 - Mandatory True (rest leave alone)
  • Field 2 - Mandatory True (rest leave alone)
  • Field 3 - Mandatory True (rest leave alone)
  • Field 4 - Mandatory True (rest leave alone)

 

I thought maybe I needed to add the annotation as Visible = true into the UI Policy Actions, but it's not an option to select.

 

Thoughts?


Thanks,

Scott

6 REPLIES 6

ruzbehv
Mega Guru

Hi Scott,



Try the following:



//Show annotation


  document.getElementById("ANNOTATION ID").parentNode.style.display="block";



//Hide annotation


  document.getElementById("ANNOTATION ID").parentNode.style.display="none";



//Set annotation id


You can set the annotation id by adding <div id="ANNOTATION ID"> before and </div> after the annotation text.



//Hide form section


  var section = $$('span[tab_caption_raw="SECTION NAME"]')[0].select('span[id*=section.]')[0];


  section.hide();


  //Hide the tab


  $$('.tab_caption_text').each(function(caption) {


  if(caption.innerHTML == 'SECTION NAME') {


  caption.up('.tab_header').hide();


  }


  });



- RV


Capture.PNG


i want to make the annotation field value dynamic. So i have given the id of the annotation(info blue box) to "helpText" and in ui policy i have written down
if(state==14)


                document.getElementById("ANNOTATION ID").parentNode.style.display="block";


else


                document.getElementById("ANNOTATION ID").parentNode.style.display="none";



but the script is not executing. Please help.


I'm sure you figured this out already, but you don't need an if statement.



There is a script field to resolve if True and one to resolve if False.  



And you'd need to replace the "ANNOTATION ID" with the annotation ID (in your case "helpText."



Works like a charm.


Hi Robert,



I also have similar issue. I have a checkbox called Confidential. I want to hide my annotation when Confidential is True.



I have used <div id="ISRM"> xxxxx </div>



I created a UI policy with condition as Confidential is TRUE. In script part, for If True I added the line:


document.getElementById("ISRM").parentNode.style.display="block";


for Else:


document.getElementById("ISRM").parentNode.style.display="none";



But it is not working.