You need to sign in to do that
Don't have an account?
Return values in a field to a drop-down on VF page
I am currently creating a page that is going to be used to track headcount in various locations.
They use the following control fields to select:
Location/State
Site
Is there a way to query the Location/Site field (currently a Text field) and convert it to a selectList or a drop-down type function I can use to filter queries?
The reason this is needed is that locations/states and sites are going to be added/removed frequently and it would be a huge headache to hard-code this as it will roll out to multiple clients.
I see some things on Describe but I am unsure on how to use it.
Any help would be greatly appreciated, thanks in advance!
This link shows you how to do it. Simply use queries to get the data instead of the hardcoded values they use.
http://www.salesforce.com/us/developer/docs/pages/index_Left.htm#CSHID=pages_compref_selectList.htm|StartTopic=Content%2Fpages_compref_selectList.htm|SkinName=webhelp
All Answers
This link shows you how to do it. Simply use queries to get the data instead of the hardcoded values they use.
http://www.salesforce.com/us/developer/docs/pages/index_Left.htm#CSHID=pages_compref_selectList.htm|StartTopic=Content%2Fpages_compref_selectList.htm|SkinName=webhelp
Thanks!
For anyone that finds this later:
Inside of:
Add:
and replace Object, FIELDNAME and change variable from r if needed.
To include a None as well, use the following:
Happy coding!
Hi - this works great with one problem...
I have repetitive values in the drop down field that I want to omit.
I've tried to use the Group By clause, but I get this error:
Save error: Loop variable must be an SObject or list of AggregateResult
If I take the Group By out, I get duplicate items in the list.
Help?!
Hey, you need add a way to check against a list and then don't add if it's not unique.
Here is a snippet that works:
The code snippet i pasted above using a Set takes care of that.
Thanks! This worked great!