Related list is not visible in onload client script

RiyazAhamed
Tera Contributor

Hello,

I am doing a task where depends on a field value I need to Hide/Show a related list in 'GRC: Policy and Compliance Management'

 

Functionality is already available in client scripts, OnLoad and OnChange client scripts.

I just added one more condition in the scripts. In DEV both are working fine. But in QA Onload functionality is not working.

The client script names are "Source management on load" and "Source management on change". 

 

On Change the Related list is visible after saving the record the related list is not visible/hidden. It is only in QA not in DEV.

 

I have verified the plugin version is same in both the instance.

 

Additional info: I am able to reproduce the issue in my PDI.

I added an OR condition in the client script 'Source management on load'  and facing the issue.

RiyazAhamed_0-1753418519248.png

 

 

Thanks,

 

16 REPLIES 16

Hi @RiyazAhamed , 

Try to see if any other conditions are there based on policy field that might be hiding the related list back again.

 

Please mark correct/helpful if my response helped you

For that particular related list, no other UI policy

Any Client script ? and check the page for any errors 

@RiyazAhamed 

This should work. I dont know why is it not working. You can also try != "" condition like below

g_form.getValue("policy") != ""

Thank you,
Palani

Pranesh072
Mega Sage
Mega Sage

Your if statement conditions are incorrect. You have to compare the values after fetching it using g_form.

So if policy should not be empty then you can write as 

g_form.getValue('policy')!=''

 

Similarly update the policy statement as well. 

 

Better to use ui policy to hide the related list using UI Policy Related List Actions

https://developer.servicenow.com/dev.do#!/learn/learning-plans/xanadu/new_to_servicenow/app_store_le...