1

We have a custom object with a list of "Types" that can be associated with a Contact record. We also maintain a custom multi-select pick list field on Contacts with those types. A contact owner can add or remove Types from the contact record as needed. We have a critical need to eliminate the manual maintenance of the contact picklist values, and have the available values pulled directly from the Types in the custom object. The custom object has one record per type, and type is a unique key. There are numerous other fields on the Type custom object. Is there a way to pull the multi-select picklist values directly from the custom object? Or, is there a way to automatically update the picklist from the custom object? We prefer a declarative solution if possible, but if code is necessary that will still help. One additional criteria. We inactivate types in the custom object by flipping a Boolean field off. The solution needs to update the picklist with only active types. When a type is inactivated we want it removed from the contact picklist. The reason we need to automate this process is it takes weeks to go through the development and implementation process to change the picklist values, but we have a requirement to activate new Types within one day. Thanks!

1
  • Thank you Dave. That was a fantastic answer! This is a Federal Government installation with tens of thousands of users, and absolutely unwilling to consider any fast track process that would impact production without going through all of the steps. I was hoping there might be a process I'm not aware of, but based on your response it sounds like the junction object may be what is required. It is unfortunate Salesforce does not support using a custom object as the value source for the picklist. Thank you again for your quick and thorough answer.
    – Vail Brown
    Commented Dec 27, 2018 at 23:21

1 Answer 1

3

Is there a way to pull the multi-select picklist values directly from the custom object?

No, there is not.

Or, is there a way to automatically update the picklist from the custom object? We prefer a declarative solution if possible, but if code is necessary that will still help.

There is only a code-based solution, and it isn't particularly easy. It would involve writing some complex Scheduled Apex to talk to the Metadata API, collate the Type custom object and the various picklist values, and deploy updates. While doable, this is a route I would take when other options are exhausted.

Alternate Solutions

Process

The reason we need to automate this process is it takes weeks to go through the development and implementation process to change the picklist values, but we have a requirement to activate new Types within one day.

This process seems to be the real point of breakage to me. The first solution path that I would follow is establishing a more reasonable change management process for well-documented, low-impact declarative changes. A process that is comfortable with a scheduled Apex process automatically updating picklist value sets with no oversight, but isn't comfortable with a trained administrator following documented processes to do the same thing, seems wrong to me.

Data Model

Instead of a multi-select picklist + a custom object, implement a junction object between Contact and Type. Then, there's no synchronization need at all, and your data's always in sync. Validation rules and lookup filters can ensure that only Types matching your specific requirements are added to Contacts.

You would need to review your existing reports and any automation built around Type assignment to determine the impact of such a change. There would also be user training necessary, although it's still using out-of-the-box Salesforce idioms that would hopefully be familiar.

If necessary, you can use a tool like Declarative Lookup Rollup Summaries to populate summarized Type data (like a semicolon-delimited list of associated Types, a la the existing multi-select picklist) into a field at the Contact level.

1
  • 1
    @vailbrown - one could also put a VF or Lightning page w/ controller that did all the CRUD on the Type__c object; calling out to the Metadata API to update the MSP on Contact.
    – cropredy
    Commented Dec 28, 2018 at 2:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .