+ Start a Discussion
Stéphanie ParkStéphanie Park 

How to update a multi-picklist on contact/lead based on a campaign field?

I am a Salesforce admin with no development knowledge.

I would need some help with the following:

I am trying to update a multipicklist on lead/contact object after they become members of a campaign (of a certain record type). The campaign has a multipicklist with certains values and I want to add these values to the multipicklist of the lead/contact without deleting the values that were already stored in the field previously.

I'm not sure if that's clear... Any help would be greatly appreciated.
Many thanks.
Would need a trigger most probably. Might not be possible using workflows as its actually Campaign Member that is being created here and I guess Campaign lookups on Contact and Lead are not changing. Correct me if I am wrong.
Stéphanie ParkStéphanie Park
The process is as follow:
A form on a webpage allows people to register to our event (=campaign). The campaign has attributes stored in multipicklists. When a new campaign member is created, we want to copy the attributes to the contact/lead associated with the campaign. We want to do an update of the MPL field on the contact/lead and not erase data already stored .
This should require a trigger.
Multi-picklist values are stored in database as semi-colon (;) separated like PMI;IIBA;ScrumAlliance.
In the trigger, you should split the MPL field value on ';' character for all the 3 records. Then run a comparison between Campaign's values and Contact's values, whatever value is present on Campaign but not on Contact, you may concatenate to already existent value on contact using ';' as separator. Same for Lead as well. For comparisons an easy way would be to employ the retainAll() or removeAll() methods provided by Sets.
If this is resolved, please do mark the question as Resolved and the most appropriate/helpful answer as the best answer :).
If none of the answers helped you significantly, please post the solution. You may also mark your solution as the best answer.