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

Custom Filed to express many to many relationship

I was reading's documentation. It is great that I can create custom fields to store data. My question is can custom fields or any other features in support many to many relationship. this is what i am trying to do. I want to have checkboxes to represent categories of a product. the problems is the product can belong to more than one category, meaning more than one checkbox can be checked at the one time. well right now i think i can just add a X amount of custom fields say Category1, Category2...CategoryX into a section. but is there any other ways to do this in salesforce?

Thanks for you help.

The best way is use a multipicklist you update manually when a product category is added and/or create an alert on products (I do not know if it is possible though) otherwise poll every x (x depending on how often you create product category) and with a bit of scripting you could go and update the multi picklist

Hope this help.

You can also simulate this with a custom object that has a lookup to X and Y. These are basically foreign keys, and show up as such in the API. If the number is small, the multipicklist could work too.