Hide/show related list

brown9394
Tera Expert

Hi Experts,

I have a related list I'm wanting to hide through UI Policy when state 'is one of' draft, pending, WIP. I've been able to do this before via getting the related list value from List Control and putting it directly in the UI Policy Script. I've set my 'when to run' conditions in place and I have the 'onLoad' checked, and 'reverse if possible' checked. Not sure why this isn't working.

function onCondition() {

  g_form.hideRelatedList('REL:7bb4a2e0134e6e001b8f3598d144b03b');

}

function onCondition() {

  g_form.showRelatedList('REL:7bb4a2e0134e6e001b8f3598d144b03b');

}

1 ACCEPTED SOLUTION

That would be an embedded list James. The function you are using wouldn't work for that. Refer to this link: Hiding Related Lists and Embedded Lists - ServiceNow Guru


View solution in original post

9 REPLIES 9

BALAJI40
Mega Sage

Instead of giving sys_id, give the name of related List.


so something like this I tried, didn't work



function onCondition() {


  g_form.hideRelatedList('Total Cost');


}


check that was Exact name or not. Check using system ui --> related lists


actually that Ui policy wanna work, but why it should failed? please provide screen shot for that


Maybe I have this wrong - I created a 'Relationship' that queries a 'Total Cost' table for specific fields and puts it on a 'Finance' table. I used 'Form Layout' to put this on the 'Finance Table' form. It is still considered a Related List right?