12

Safe Harbor: this is a really long answer...read at your own risk. Also, none of this sample code has been tested, this is just me stubbing it out in Notepad++. This is not currently possible with standard Salesforce configuration, as multi-select picklists cannot be selected as the Controlling Field in a Field Dependency. So, you're definitely looking at a ...


11

So the first thing to note is that according to the help docs Bind expressions can't be used with other clauses, such as INCLUDES. This means you will probably have to use a dynamic query. The help docs here give a great run down of the ways to query multi select picklists For your question: To query the multi select picklist where Bank AND ...


11

You've forgotten a required attribute. The radioGroup is grounded in HTML's <input type="radio" />, which uses a "name" attribute to determine groups. If you forget to specify the name, the options actually behave like independent radio groups. The following change is necessary for proper operation: <lightning:radioGroup name="recordTypes" options="...


10

These are methods I use for this purpose: public static String format(Set<String> values) { if (values == null) return null; List<String> l = new List<String>(values); l.sort(); return format(l); } public static String format(List<String> values) { if (values == null) return null; return String.join(values, ';...


10

Multi-select picklist values are stored as a semicolon separated string. Thus to set a value via apex containing options 'a', 'b and 'c', you'd have something like: configItem.Chose_Code__c='a;b;c';


8

Currently there will be no solution without tradeoffs. In most cases I tend to pick approaches which provides good UX and best convenience for the users. To get something user friendly multiselect picklists doesn't come close. They give me a feeling of the year 2003, more than a few choices end up in scrolling tapestries and selecting+deselecting feels like ...


7

<apex:attribute name="leftOptions" description="Options list for left listbox." type="SelectOption[]" required="true" assignTo="{!leftOptions}" /> <apex:attribute name="rightOptions" description="Options list for right listbox." type="SelectOption[]" required="true" assignTo="{!rightOptions}" /> The above code can be changed as below <apex:...


6

From the Multi-Select Picklist Field Type documentation: Multi-select picklist fields contain a list of one or more items from which a user can choose multiple items. One of the items can be configured as the default item. So based on the documentation alone, I'd say it isn't possible to select more than one default item. Idea to promote: Multiple ...


6

You don't have the ability to specify the style for this input field, as it generates complex HTML. You can sometimes override the styles by specifying others with the same name in your page, but this would be very fragile as if Salesforce change their styling it would suddenly break. When I've needed to style the multi-select picklist, I've created my own ...


6

Multi-picklists are notoriously difficult to work with and I avoid them at all costs. There is no way around the 150 item limit. Summary reporting is completely impossible with multi-select as it summarizes for each possible combination. I would suggest using a child object that stores what countries/languages the account operates in. You most likely have ...


5

You can do this by following the relationship in the query, e.g. select accountId, account.Name, id from contact order by accountId There are more examples in the SOQL docs


5

// create a map of Contacts by Account Ids Map<Id, List<Contact>> ContactMap = new Map<Id, List<Contact>>(); // query (where/and conditions can be added as needed) List<Account> Accounts = [Select Id, Name, (Select Id, Name From Contacts) From Account]; // loop through all retrieved Accounts for(Account a : Accounts) { ...


5

A work around i have used in the past is to create a formula field for each of the permutations of the multi select that you want to track. I've used a number formula to make record counts easier in reports but the new boolean formulas in summer 13 could be a good alternative IF(Includes(Multi_Select_1__c , "White"),1,0) one of these for each colour should ...


5

What you're asking can't be accomplished through a validation rule, without hand coding every value like you suggested. On the other hand this could very easily be accomplished with a before update trigger that looks something like this: trigger MyTrigger on MyObject__c (before update) { //this variable could also be gotten through use of the system ...


5

Sure this can be quite a straightforward VisualForce page addition. I will provide some leads below which should be enough to get you to a solution. Everything should be added to your existing page / controller. In order to have a popup-effect but keep your current state (after selecting the users, you want to return the result to the page at which you're ...


5

Since we already have some approaches, I shall try for a new one and bit more simplified. Create 2 Multiselect picklist fields. Field1 with values : A to M Field2 with values : N to Z Let the user select values for both or any one of field. Write an apex trigger to concatenate the values selected in these 2 fields and store it in a hidden field(from ...


5

The part of your query where you're saying (Select Id, WhoId FROM Tasks WHERE IsClosed = false) is known as a Left Outer Join, or a Parent-Child Subquery. A semi-join is similar, but different (a semi-join is a subquery in the WHERE clause, not the SELECT clause). In those subqueries, the name of the object you're targeting changes. You need to use the ...


4

An alternate comparison mechanism can be employed here, using the Set type instead of the string.equals method. You can use the Set<>.containsAll(Set<>) in both directions to check whether both Sets contain the same elements. Set<String> firstSet = new Set<String>('item1;item2;item3;'.split(';')); Set<String> secondSet = new Set<...


4

The keyword here is the setEscapeItem(false) of the SelectOption class. In my example i will generate an option group styled with css and some colored options. There is a bug if you trying to insert unescaped html tag into the selectOption list. The visualforce adds empty values, that must be removed with some simple javascript: Controller: public List<...


4

This would definitely have to be custom. To do this, you would need to repeat over a List<SelectOption> using an <apex:repeat> to generate out a list of <apex:selectOption> while inside an <apex:selectList>. Unfortunately, <apex:selectOption> had style and styleClass deprecated in API 17, so the only way to apply the proper ...


4

Multi-select picklists look like a semi-colon delimited string to your code. So, you can just use split(';') to get an array of all the picklist values. You can then use the IN operator. SELECT Name from Object__c where PicklistField__c IN :multselect.split(';')


4

No, this isn't possible. The standard method to implement something like this is what's known as a Junction Object. This junction object allows you to create the many-to-many relationship that you're envisioning as a picklist. In your case the junction object could be called ProjectProduct__c and that object will have two lookups on it, one to Project and ...


4

Solution Page <apex:page controller="MutiselectPicklistTest"> <apex:form> <apex:pageBlock> <input type="button" onclick="checkselected();" value="click" class="btn"/> <script> function checkselected(){ var x=document.getElementById("selectId"); var selectOptions = []; ...


4

I think you've run into a documented limitation of multi-select picklists. Multi-select picklists can be dependent picklists but not controlling fields. That would be why you can't use the multi-select values to create another dependency. See Dependent Picklist Considerations.


4

Is there any direct methods to check the count instead of List and Split method using ';' Nope, splitting by semicolon and calling size() on the resulting list is pretty much it. There are probably one or two other ways (1 + # of semicolons), but the method you're using now is likely the simplest. Does the above code have any loop holes? Probably not. ...


4

These are not compact layouts. They are action layouts, which may be associated with either global actions or with object-specific actions. Global Actions are available in Setup. Object-specific actions can be accessed in the Buttons, Links, and Actions section for the associated sObject in Object Manager. Both types of action can have their associated ...


3

You can use a nested for loop to iterate through subquery results: List<Account> accList = new List<Account>([ SELECT Name, Id, ( select Id from Contacts ) FROM Account ORDER BY Id ]); Map<String, Contact> conMap = new Map&...


3

Try something like this //your query String query = ''; if(multiselectList.size() > 0){ String s = ''; Integer i = 0; for(Id agId : multiselectList){ if(i==multiselectList.size()-1){ s += '\''+agId+'\''; }else{ ...


3

In the getItems method, query for the values already selected and put into a Set When constructing the selectOptions list, check if the selected set contains the key of the SelectOption you are attempting to construct and if already selected, continue. Pseudo code below public list<selectoption> getitems() { Set<String> ...


3

I can't find it documented anywhere, but it appears you can't count on a specific ordering of the multi-select values in the object. In lieu of comparing the ;-concatenated version that comes from the database, push them into a set and compare them that way. Example Set<String> tVals = (String.isBlank(t.AccountSegment__c)) ? new Set<String&...


Only top voted, non community-wiki answers of a minimum length are eligible