Show or Hide Embedded List

snowuser111
Kilo Guru

Hi Guys,

 

I want to show or hide Embedded list based on a single condition . Have got in other post regarding this and was relly helpful.

http://www.servicenowguru.com/scripting/client-scripts-scripting/hiding-related-lists-embedded-lists...

 

But I want to hide /show based on condition, when I select 'Affecting' as Regional as per snap shot below ,only then it should display embedded list(Affected Locations).

My Client script is working perfectly without any condition. For above condition can anyone help how to proceed please.

*********************************************************************************************************************************************

function onLoad()
{
              //Type appropriate comment here, and begin script below
          var list = $$('div[tab_caption="Affected Locations"]')[0];
          if(list.hasClassName('embedded'))
          {
                      list.show();

          }
   
}

**********************************************************************************************************************************************

Embedded List.jpg

 

Many Thanks

4 REPLIES 4

syap
Tera Contributor

Get the value of the Affecting field and add it in your IF condition.


You can use a UI Policy. Check the "Run Scripts" option, set your conditions, and then use the Execute if true script block to show the embedded list and use the Execute if false script block to hide it.



Michael


@Michael Domke

hello I try it but the no admin user have a problem. why is it?

songchunpu_0-1675323720654.png

songchunpu_1-1675323748257.png

 

Make sure the DIV tab_caption string value is identical.

2023-02-03_13-52-41.png

 

 

 

 

 

 

Michael