+ Start a Discussion
Priyadarshini Manoharan 3Priyadarshini Manoharan 3 

How to update a multi-select picklist field at Lead level from a multi-select picklist field at Campaign Level

How to update a multi-select picklist field at Lead level from a multi-select picklist field at Campaign Level? when the multi-select picklist field at Lead level is blank
Best Answer chosen by Priyadarshini Manoharan 3
Priyadarshini Manoharan 3Priyadarshini Manoharan 3
This issue is fixed. It is because of the for loop, missed closing the for loop before the soql.

All Answers

HARSHIL U PARIKHHARSHIL U PARIKH
There is a junction object between Lead and Campaign named Campaign Members.

Throw the value in campaign member from campaign and then on the lead itself. But however, if lead is part of multiple campaign means if the lead has more than one campaign member records then which value would be appropriate?

You can tell us your requirements in depth and will see if this possible or not?
Thank You!
Priyadarshini Manoharan 3Priyadarshini Manoharan 3
Thanks Govind!
I have written an apex trigger after insert on CampaignMember object.
the soql query  below shows null value for Campaign.Multiselectpicklist__c while debugging in apex trigger, however in the developer console it shows the value of the field seperated by ;. The issue is because it is showing null value in the soql, when I assign this to Lead.Multiselectpicklist__c, it still remains null.
Another question is can I assign one multselect picklist value to another like this? currentLead.Multiselectpicklist__c = CamMeminLoop.Campaign.Multiselectpicklist__c;
else please suggest how I can assign one multiselect picklist value to another.

list<CampaignMember> allCamMemlist = [SELECT Id, LeadId, CampaignId , Campaign.Multiselectpicklist__c, Lead.Multiselectpicklist__c FROM CampaignMember where LeadId IN :allLeadIds and Campaign.Multiselectpicklist__c != null and Lead.Multiselectpicklist__c=null];
Priyadarshini Manoharan 3Priyadarshini Manoharan 3
This issue is fixed. It is because of the for loop, missed closing the for loop before the soql.
This was selected as the best answer