You need to sign in to do that
Don't have an account?
Néstor Velázquez Sánchez
How to show a specific picklist by the record type
Hi, I have a big problem.
I have an OptionList, this OptionList come from a bigest query:
I have an OptionList, this OptionList come from a bigest query:
/* CONTROLLER */ optiones = [SELECT someFields myField__r.RecordTypeId FROM myCustomObject__c WHERE (myField__r.RecordTypeId=: RTPersonalProduct2 OR myField__r.RecordTypeId=: RTMusicProduct2) AND myField__c IN: theList AND otherField__c NOT IN: mapAssetsProduct.keySet() AND myField__c NOT IN (SELECT myField__c FROM Booking__c WHERE ((dateStart__c >=: listDates1) AND (Fecha_fin__c <=: listDates2)) AND (hour__c IN: hourStarList AND hour2__c IN: hourFinalList) )]; for(object__c r: optiones) { options.add(new SelectOption (r.myField__c, r.Product__r.Name)); } /* Visual Force Page */ <apex:selectList value="{!asset.substituto}" size="1" multiselect="false" > <apex:selectOption itemLabel="-- SELECCIONA UN SUSTITUTO --" itemValue="" /> <apex:selectOptions value="{!options}" /> </apex:selectList>
Where asset.substituto is a Map: Map<String, List<>>
The issue is: I want use an selectList ONLY for a RecordType = RTPersonalProduct2 and display other selectList for the RecordType = RTInstrumentosProduct2
I don't kwon how use the values or the fields to use one or other list, I only get a bigest list with all elements.
If you know how access to the System.SelectOption to manipulate the option value elements, please help me.
It's really simple if something then whatever but in the visual force it's not possible or I don't know how.
May I suggest you please check with below link from stack exchange community with a similar issue which will point you in the right direction.
- https://salesforce.stackexchange.com/questions/103837/how-do-i-get-the-intersection-of-recordtype-and-picklist-values-inside-apex
Please let us know if this helps.Thanks,
Nagendra
I am coming from future and let teach you how We can did make it:
1. Create a String public variable.
2. Using a public list with the options you fill the options list select:
3. In the Visualforce Page use the apex component for SELECT:
This the steps to follow.
Thanks for reading.