النوع الثاني: ما يكون حسنا بواسطة الغير
The second kind is good because of something else, through an intermediary relationship.
This is called ḥasan li-ghayrihi. The act is legally relevant as a means or prerequisite to another legally intended result. Traveling to the Friday congregational prayer is an illustration because it enables attendance at that prayer.
One must identify the underlying required act, explain how the means serves it, and then determine what happens to the means if the underlying need or required objective is no longer present.