function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Default Master Account and Product Lookup

I have a custom Membership object that has a master-detail with Account, a lookup relationship with Contact, and a lookup relationship with Product. This is because a membership is owned by an account and is non-transferable, while a Contact uses the membership but is transferable to other employees of the Account. And there are various types of memberships available, thus the lookup to Product.

When I create a new Membership from an Account, the Account is populated, good. The user has to select a contact from the Account's employees, no problem.

Creating a new Membership from a Contact, the Contact field is populated. Also good. But in the latter case, I'd like to populate the Account, which is, of course, the Contact's Account. How can I do this? A trigger won't work, because they fire when the record is being saved. There are no default fields for master-detail relationships. I can't figure out how to run any code in the New Membership window to do this.

Is an s-control the answer? Even if I figure out how to make that work, I'd prefer that the user not have to click a button for something that can only be one thing, the Contact's Account.

Also, how can I put a default Product in that field?

Thanks for any ideas!