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.

How to create Related List

Sirri
Tera Guru

Hi All,

 

I have requirement 

1)company table (core_company) Default view.

2)contract table (ast_contract) 

 

In ast_contract table there is field Vendor which is reference to core_company table. 

My requirement is we should created new related list- contract in core_company table in default view . In that contract  we should want to display contracts based on that company and contracts state is = Active/Expired one's only.

I'm expecting the contract related list at the highlighted place in the below snip. please let us know how to achieve this.

Sirri_0-1710777857684.png

 

 

 

Thank you

1 ACCEPTED SOLUTION

@Sirri , as i can see there are 4 choice for state Draft, active, expired, cancelled so in the below i have removed expired and cancelled to show Draft and active ones only similarly if your requirement is different you can add encoded query or you can add  current.addQuery .

swathisarang98_0-1710843253857.png

 

 

(function refineQuery(current, parent) {

	// Add your code here, such as current.addQuery(field, value);
	current.addQuery('vendor.name',parent.name);
	current.addQuery('state', "!=",'expired');
	current.addQuery('state',"!=", "cancelled");

})(current, parent);

 

 

Please mark this comment as Correct Answer/Helpful if it helped you.

Regards,

Swathi Sarang

View solution in original post

13 REPLIES 13

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @Sirri 

 

The yellow mark is for Related list, not section mate.

*************************************************************************************************************
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]

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

Hi @Dr Atul G- LNG ,

 

Thanks for response,

 

please let us know how create related List as per requirement mention above.

 

Thank you 

Right click on context menu -- configure -- Related List 

Move the required related list to left side, and save.

*************************************************************************************************************
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]

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

@Dr Atul G- LNG ,

 

Related List is not created how create related List as per the  requirement mentioned above . please let us know how create this.

 

Thank you