Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Related List view configuration

DPrasna
Tera Contributor

Hi All,

I have the requirement as follows

There is a company form with "Customer" View and I added a related list "Companies" - child company list

 

DPrasna_0-1700647790791.png

 

I have another Related List "Business Service

 

DPrasna_1-1700647859807.png

 

But I want this Related list to be visible only on Records that are on Child "companies" related list meaning when Parent is not empty.

Is there a way to achieve the same? like in a different view where "Parent" is not empty then show this related list.

 

Please let me know.

Thanks

@Ankur Bawiskar @Danish Bhairag2 @Sandeep Rajput @Tai Vu 

 

1 ACCEPTED SOLUTION

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @DPrasna 

 

https://www.servicenow.com/community/developer-forum/how-to-hide-a-related-lists-based-on-certain-co...

 

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

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

View solution in original post

3 REPLIES 3

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @DPrasna 

 

https://www.servicenow.com/community/developer-forum/how-to-hide-a-related-lists-based-on-certain-co...

 

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

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

@DPrasna 

You can sue UI policy.

 

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

 

 

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

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

Tai Vu
Kilo Patron
Kilo Patron

Hi @DPrasna 

Let's define an OnChange Client Script on the Parent field.

 

function onChange(control, oldValue, newValue, isLoading, isTemplate) {

    if (!newValue) {
        g_form.hideRelatedList('cmdb_ci_service_business.company');
		return;
    }

	g_form.showRelatedList('cmdb_ci_service_business.company');

}

 

 

Same for UI Policy.

TaiVu_0-1700648936496.png

 

 

Cheers,

Tai Vu