Obtaining page object context for a many-to-many related object on the page

Hey! I have a list of contacts (Remote object), with a Many-to-Many relationship to the Case object. Any contacts added to the case are automatically given this relationship. When a letter is sent out, all linked contacts are given an additional relationship back to the same case (by matching) to establish that they have been sent the letter. This part works!

However, I now want to achieve two things:

  • Make any contacts that have been sent the letter read-only. Attempted to control this with a subset, but since the contacts list and the subset are both rooted in the contacts object, it seems that a viable link back to any case (not just the case that’s open on the page) has the contact set as read-only for every case.
  • Hide elements of the case page until all linked contacts have been sent the letter. As the above subset didn’t work, this also doesn’t work.

I’m aware I can extract the page context if I take this into code, but I want to check if there’s already built-in functionality in Liberty Create for this kind of setup. I’d appreciate any insight on this problem!

It may be too late to change your schema now, but this could be handled with a link object. So rather than a direct many-to-many between Contacts and Cases, you have an object in between such as “Case Contact”, with relationships as:

Case --< Case Contact >-- Contact

The end result is largely the same, it still acts similarly to an M2M, but when you relate a Contact to a Case (via that new object), a record is created in it which represents that relationship.

This would then allow you to use a boolean Property in that new object to indicate if the letter is sent or not, and your subset can be based on that object rather than the Contact itself. This allows, for example, on your case page to have a list of only the Contacts which have/have not received the letter.

You also wouldn’t need a second M2M relationship at all.