You could do the following in a field update for Comment__c
value would be set to
IF(INCLUDES(MSP__c,'BusinessA'),'Business A: <your notes here>',NULL) &
IF(INCLUDES(MSP__c,'BusinessB'),'Business B: <your notes here>',NULL) &
...
IF(INCLUDES(MSP__c,'BusinessZ'),'Business Z: <your notes here>',NULL)
where the result would be a text field that would look like (say Business C and Business E were chosen by user):
Business C: <your notes here> Business E: <your notes here>
and user could move the cursor to add in comments after each relevant business.
The above will break down if you have many MSP values as the formula will get too large - in that case, a trigger will be the best bet
To update a contact object formula field based on the values from the account object multi-select picklist . In contact formula field write down as
IF(INCLUDES(Account.Multi_select__c,"value"),"value;",null)&
IF(INCLUDES(Account.Multi_select__c,"value"),value;",null)&
IF(INCLUDES(Account.Multi_select__c,"value"),"value;",null)&
IF(INCLUDES(Account.Multi_select__c,"value"),"value;",null)
and goes on. When my formula field has more characters this is the error I faced
The formula expression is invalid: Formula is too long (6,647 characters). Maximum length is 3,900 characters .
In that case, try to use trigger its a good choice.
trigger accountTrigger on Account(after insert,after update) {
List<contact>contactlst = new List<contact>();
List<contact> cnt = new List<contact>();
map<string,string> mapOfAccntIds = new map<string,string>();
for(Account act:Trigger.new){
mapOfAccntIds.put(act.id, act.Multi_select__c);
}
contactlst = [select id, Multi_Select_Text__c, name, AccountId from
contact where AccountId IN: mapOfAccntIds.keySet()];
for(contact c :contactlst ){
c.Multi_Select_Text__c= mapOfAccntIds.get(c.accountId);
cnt.add(c);
}
}
if(cnt != null & cnt.Size()> 0)
upsert cnt;
}
Best Answer
Ok, so assuming you have just completed step 1, you have a large list in picklist 1 and a smaller list in picklist two.
I'm also assuming that you are using databinding in lightning are are not directly manipulating the DOM
Given these conditions, run your first list through this function. It will remove any dupe values already in the second list: