Hide embedded list with UI Policy

JJG
Kilo Guru

Hello,

I have a checkbox field, when it is selected I would like the embedded list underneath to be hidden. How can I do this?

Here is what I have so far in my UI Policy:

Condition: when checkbox is true

Script:

g_form.hideRelatedList('SF Involvement in Non - Criminal Court Actions 28');

Here is a picture of the form:

find_real_file.png

18 REPLIES 18

 

Did you check the blog which i had shared, DOM manipulation required here. 

 

tested script , make sure Isolate script field has set false

 

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
	if (isLoading || newValue === '') {
		return;
	}
	if(newValue){ // check the condition here
		var list = $$('div[tab_caption="Approvers"]')[0];
		if(list.hasClassName('embedded')){
			list.hide();
		}

	}
	else{
		var list = $$('div[tab_caption="Approvers"]')[0];
		if(list.hasClassName('embedded')){
			list.show();
		}
	}

This did not work, I used this script in my UI policy and it didn't hide the embedded list

I want to make sure we are on the same page, I am not hiding a tab or section, I am trying to hide an embedded list 

I got this error:

find_real_file.png

Here is the code I used:

var list = $$('div[tab_caption="SF Involvement in Non-Criminal Court Actions 28"]')[0];
    if (list.hasClassName('embedded')) {
        list.hide();
    }

This is i had tried at my end using UI Policy and working. 

 

find_real_file.png

 

Script:

 

find_real_file.png

 

Result

 

find_real_file.png

 

 

It is not working for me, here is what I have:

find_real_file.png

 

find_real_file.png

Can you check the browser console log ? are you getting any error?

also is it possible just for testing can you try to add OOTB embedded list eg: the one which i have added, and test it . 

I am just guessing here if its not working due to the embedded list name, give a try to hide OOTB for testing purpose. 

Lets add some alert in your UI Policy, let me know exactly its returning you. 

below line will return true

 

function onCondition() {

	var list = $$('div[tab_caption="Approvers"]')[0];
	alert(list.hasClassName('embedded')); // is this giving true? 
	if(list.hasClassName('embedded')){
		list.hide();
	}
}

 

Note: New client-scripts are run in strict mode, with direct DOM access disabled. Access to jQuery, prototype and the window object are likewise disabled. To disable this on a per-script basis, configure this form and add the "Isolate script" field. To disable this feature for all new globally-scoped client-side scripts set the system property "glide.script.block.client.globals" to false.